Created
          March 5, 2012 03:51 
        
      - 
      
- 
        Save ukstudio/1976457 to your computer and use it in GitHub Desktop. 
    rspec-http-matchers
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Rack::Utils::SYMBOL_TO_STATUS_CODE.each do |symbol,code| | |
| matcher_name = symbol.to_s =~ /^not_/ ? symbol : "be_#{symbol}" | |
| RSpec::Matchers.define matcher_name do | |
| match do |response| | |
| response.code.to_i == code | |
| end | |
| end | |
| end | |
| # subject { response } | |
| # it { should be_success } | |
| # it { should not_found } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment