test/canard/user_model_test.rb in canard-0.4.2.pre vs test/canard/user_model_test.rb in canard-0.4.3
- old
+ new
@@ -10,11 +10,11 @@
PlainRubyUser.acts_as_user
end
it 'adds role_model to the class' do
PlainRubyUser.included_modules.must_include RoleModel
- PlainRubyUser.must_respond_to :roles
+ PlainRubyUser.new.must_respond_to :roles
end
end
describe "with a roles_mask" do
@@ -40,22 +40,22 @@
end
end
end
describe "with no roles_mask" do
-
+
before do
PlainRubyNonUser.acts_as_user :roles => [:viewer, :author, :admin]
end
it "sets no roles" do
PlainRubyNonUser.valid_roles.must_equal []
end
end
-
+
describe "setting the role_mask" do
-
+
before do
PlainRubyNonUser.send :attr_accessor, :my_roles
PlainRubyNonUser.acts_as_user :roles => [:viewer, :author], :roles_mask => :my_roles
end
@@ -115,10 +115,10 @@
subject.can?(:edit, Post).must_equal true
subject.can?(:update, Post).must_equal true
subject.can?(:show, Post).must_equal true
subject.can?(:index, Post).must_equal true
end
-
+
it "has no other abilities" do
subject.cannot?(:destroy, Post).must_equal true
end
end
end