Class: ScraperWiki::API::Matchers::UserRolesMatcher

Inherits:
ScraperInfoMatcher show all
Defined in:
lib/scraperwiki-api/matchers.rb

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from ScraperWiki::API::Matchers::CustomMatcher

Instance Method Details

#failure_messageObject



128
129
130
# File 'lib/scraperwiki-api/matchers.rb', line 128

def failure_message
  "expected #{@actual['short_name']} to be editable by #{@expected}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


121
122
123
124
125
126
# File 'lib/scraperwiki-api/matchers.rb', line 121

def matches?(actual)
  super
  %w(owner editor).any? do |userrole|
    actual['userroles'][userrole].include? @expected
  end
end

#negative_failure_messageObject



132
133
134
# File 'lib/scraperwiki-api/matchers.rb', line 132

def negative_failure_message
  "expected #{@actual['short_name']} to not be editable by #{@expected}"
end