module Shoulda::Matchers::ActionController
By using the matchers you can quickly and easily create concise and easy to read test suites.
This code segment:
describe UsersController, 'on GET to show with a valid id' do before(:each) do get :show, id: User.first.to_param end it { should respond_with(:success) } it { should render_template(:show) } it { should not_set_the_flash) } it 'does something else really cool' do expect(assigns[:user].id).to eq 1 end end
Would produce 5 tests for the show action
Public Instance Methods
permit(*params)
click to toggle source
# File lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb, line 13 def permit(*params) StrongParametersMatcher.new(params).in_context(self) end
rescue_from(exception)
click to toggle source
# File lib/shoulda/matchers/action_controller/rescue_from_matcher.rb, line 4 def rescue_from(exception) RescueFromMatcher.new exception end