Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Commit

Permalink
Cleaning up spec output [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanl committed Dec 8, 2012
1 parent 3d4ece8 commit 2e85484
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions spec/authority/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,24 @@
ExampleController.authorize_actions_for ExampleModel, @options
end

it "allows adding multiple items to authority action map" do
it "passes the action hash to the `authority_action` method" do
example_controller = Class.new(ExampleController)
new_actions = {:synthesize => :create, :annihilate => 'delete'}
ExampleController.authorize_actions_for(ExampleModel, :actions => new_actions)
expect(ExampleController.authority_action_map).to eq(
Authority.configuration.controller_action_map.merge(new_actions)
)
example_controller.should_receive(:authority_action).with(new_actions)
example_controller.authorize_actions_for(ExampleModel, :actions => new_actions)
end

end

describe "authority_action" do

it "adds or updates one item in the controller's authority controller action map" do
child_controller = Class.new(ExampleController)
child_controller.authority_action(:smite => 'delete')
expect(child_controller.authority_action_map[:smite]).to eq('delete')
it "modifies this controller's authority action map" do
example_controller = Class.new(ExampleController)
new_actions = {:show => :display, :synthesize => :create, :annihilate => 'delete'}
example_controller.authority_action(new_actions)
expect(example_controller.authority_action_map).to eq(
Authority.configuration.controller_action_map.merge(new_actions)
)
end

it "only affects the controller it's called in" do
Expand Down

0 comments on commit 2e85484

Please sign in to comment.