Browse files

add missing file

  • Loading branch information...
1 parent ae9284a commit dc1b3c4d0e30e641ee90f9260616628173c54dfe @dnagir committed Apr 18, 2012
Showing with 27 additions and 0 deletions.
  1. +27 −0 spec/rspec_spec.rb
View
27 spec/rspec_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+require 'allowy/rspec'
+
+module Allowy
+ describe ControllerAuthorizationMacros do
+ include ControllerAuthorizationMacros
+ before { @controller = stub("FakeController") }
+
+ ignore_authorization!
+
+ it "aliases allowy as the current_allowy of the controller" do
+ allowy.should === @controller.current_allowy
+ end
+
+ describe "authorize_for matcher" do
+ it "works when authorised" do
+ should_authorize_for(:create, 123)
+ allowy.authorize!(:create, 123)
+ end
+ it "works when not authorised" do
+ should_not_authorize_for(:create, 123)
+ allowy.authorize!(:edit, 123)
+ end
+ end
+
+ end
+end

0 comments on commit dc1b3c4

Please sign in to comment.