Skip to content

Instantly share code, notes, and snippets.

@jtmkrueger
Last active June 7, 2017 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtmkrueger/27eb4efe1fcd7736c4cf389a4df04e15 to your computer and use it in GitHub Desktop.
Save jtmkrueger/27eb4efe1fcd7736c4cf389a4df04e15 to your computer and use it in GitHub Desktop.
class PretendController < ApplicationController
def create
render params
end
end
require 'rails_helper'
RSpec.describe PretendController, type: :controller do
it 'is stupid' do
params_a = {foo: 'bar'}
post :create, params_a
expect(response.request.params).to include params_a
params_b = {foo: 'baro'}
expect{post :create, params_b}
expect(response.request.params).to include params_b
end
end
DEPRECATED: Passing a block to Capybara::server is deprecated, please use Capybara::register_server instead
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Forced option passed this will rebuild indexes (drop them and then create them again)
Index created for listings
Index created for people
Index created for projects
6/6 Listings: |================================================= 100 =================================================|
44/44 People: |================================================= 100 =================================================|
3/3 Projects: |================================================= 100 =================================================|
PretendController
is stupid (FAILED - 1)
Failures:
1) PretendController is stupid
Failure/Error: expect(response.request.params).to include params_b
expected {"foo" => "bar", "controller" => "pretend", "action" => "create"} to include {:foo => "baro"}
Diff:
@@ -1,2 +1,4 @@
-[{:foo=>"baro"}]
+"action" => "create",
+"controller" => "pretend",
+"foo" => "bar",
# ./spec/controllers/pretend_controller_spec.rb:11:in `block (2 levels) in <top (required)>'
Finished in 2.38 seconds (files took 5.46 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/controllers/pretend_controller_spec.rb:4 # PretendController is stupid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment