spec/authority/abilities_spec.rb in authority-0.2.0 vs spec/authority/abilities_spec.rb in authority-0.3.0
- old
+ new
@@ -1,7 +1,8 @@
require 'spec_helper'
require 'support/ability_model'
+require 'support/no_authorizer_model'
require 'support/user'
describe Authority::Abilities do
before :each do
@@ -30,9 +31,13 @@
it "should memoize the authorizer to avoid reconstantizing" do
AbilityModel.authorizer
AbilityModel.authorizer_name.should_not_receive(:constantize)
AbilityModel.authorizer
+ end
+
+ it "should raise a friendly error if the authorizer doesn't exist" do
+ expect { NoAuthorizerModel.authorizer }.to raise_error(Authority::NoAuthorizerError)
end
end
describe "class methods" do