class RSpec::Siren::Matchers::HasAction
Public Class Methods
new(expected)
click to toggle source
# File lib/rspec/siren/matchers/has_action.rb, line 5 def initialize(expected) @expected = expected end
Public Instance Methods
description()
click to toggle source
# File lib/rspec/siren/matchers/has_action.rb, line 18 def description "have siren action '#{@expected}'" end
failure_message()
click to toggle source
# File lib/rspec/siren/matchers/has_action.rb, line 22 def failure_message "expected siren object to have action '#{@expected}' found actions: #{safe_actions.inspect}" end
matches?(target)
click to toggle source
# File lib/rspec/siren/matchers/has_action.rb, line 9 def matches?(target) @target = target @target[:actions] && safe_actions.map{|a| a[:name].to_s }.include?(@expected) end
safe_actions()
click to toggle source
# File lib/rspec/siren/matchers/has_action.rb, line 14 def safe_actions Array(@target[:actions]) end