Skip to content

Instantly share code, notes, and snippets.

@mz026
Created November 18, 2014 03:55
Show Gist options
  • Save mz026/33430e40db74124f50b7 to your computer and use it in GitHub Desktop.
Save mz026/33430e40db74124f50b7 to your computer and use it in GitHub Desktop.

Revisions

  1. mz026 created this gist Nov 18, 2014.
    9 changes: 9 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # 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