Sha256: 9bc50c569c95ff76b639defc775eac604ea05d9e3a22ad4336fe4d67d0dfa6b6

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 Bytes

Contents

class BeUnauthorized
  def matches?(response)
    @response = response
    @response.status == '401 Unauthorized' && @response.body == 'Unauthorized'
  end

  # ==== Returns
  # String:: The failure message.
  def failure_message
<<-EOS
expected the response from #{@response.request.url}
to have the status 401 Unauthorized and body 'Unauthorized'"
but the status is #{@response.status} and the body is '#{@response.body}'"
EOS
  end

  # ==== Returns
  # String:: The failure message to be displayed in negative matches.
  def negative_failure_message
<<-EOS
expected the response from #{@response.request.url}
not to have the status 200 Ok and body 'Allowed Access'"
EOS
  end
end

def be_unauthorized
  BeUnauthorized.new
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jrun-rails_doorman-0.0.1 features/support/unauthorized_matcher.rb
rails-doorman-0.1.0 features/support/unauthorized_matcher.rb