class RSpec::Siren::Matchers::HasLink
Public Class Methods
new(expected_rel)
click to toggle source
# File lib/rspec/siren/matchers/has_link.rb, line 5 def initialize(expected_rel) @expected_rel = expected_rel end
Public Instance Methods
description()
click to toggle source
# File lib/rspec/siren/matchers/has_link.rb, line 16 def description "have a link with rel '#{@expected_rel}'" end
failure_message()
click to toggle source
# File lib/rspec/siren/matchers/has_link.rb, line 20 def failure_message "has no link with rel '#{@expected_rel}'" end
matches?(target)
click to toggle source
# File lib/rspec/siren/matchers/has_link.rb, line 9 def matches?(target) @target = target link = safe_links.detect { |l| l[:rel].include?(@expected_rel) } !!link end
Private Instance Methods
safe_links()
click to toggle source
# File lib/rspec/siren/matchers/has_link.rb, line 26 def safe_links Array(@target[:links]) end