Sha256: 8cb0a8af08344044472c1ebcf6bfd2d237476af158c6ef017f98a6a7a624d633
Contents?: true
Size: 707 Bytes
Versions: 2
Compression:
Stored size: 707 Bytes
Contents
require 'acceptance_spec_helper' feature 'Protect controller actions', %q{ In order to secure my rails application as a developer I want to protect some actions } do given(:a_controller_with_guarded_actions){ ProtectControllerActionsSpec::DummyController.new.tap {|c| c.current_user = a_user} } given(:a_user){ double('user', create_allowed?: false, show_allowed?: true) } scenario "access protected actions without permission" do expect{a_controller_with_guarded_actions.create}.to raise_error AccessPolicy::NotAuthorizedError end scenario "access protected actions with permission" do expect{a_controller_with_guarded_actions.show}.not_to raise_error end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
access_policy_rails-0.0.2 | spec/acceptance/protect_controller_actions_spec.rb |
access_policy_rails-0.0.1 | spec/acceptance/protect_controller_actions_spec.rb |