Class: RSpec::Http::ResponseCodeMatcher
- Inherits:
-
Object
- Object
- RSpec::Http::ResponseCodeMatcher
- Defined in:
- lib/vagrant-test-subject/monkey-patches/rspec-http.rb
Instance Method Summary collapse
- #common_message ⇒ Object
-
#matches?(target) ⇒ Boolean
Override, this stupidly doesn’t work with the stdlib net/http.
Instance Method Details
#common_message ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/vagrant-test-subject/monkey-patches/rspec-http.rb', line 16 def status_code = (@target.respond_to? :status) ? @target.status : @target.code = "have a response code of #{@expected_code}, but got #{status_code}" if status_code == 302 || status_code == 201 += " with a location of #{@target['Location'] || @target['location']}" end end |
#matches?(target) ⇒ Boolean
Override, this stupidly doesn’t work with the stdlib net/http
6 7 8 9 10 11 12 13 14 |
# File 'lib/vagrant-test-subject/monkey-patches/rspec-http.rb', line 6 def matches?(target) @target = target if @target.respond_to? :status then return @target.status.to_s == @expected_code.to_s elsif @target.respond_to? :code then # Net::HTTPResponse return @target.code.to_s == @expected_code.to_s end end |