Created
          November 18, 2014 03:55 
        
      - 
      
- 
        Save mz026/33430e40db74124f50b7 to your computer and use it in GitHub Desktop. 
    RSpec required in controller params
  
        
  
    
      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
    
  
  
    
  | # Usage: | |
| # include_examples 'require_in_params', :tag, ->(group) { post :create, params } | |
| shared_examples "require_in_params" do |attr, block| | |
| it "returns 400 if no `#{attr}` in params" do | |
| params.delete attr | |
| self.instance_eval &block | |
| expect(response.status).to eq(400) | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment