Sha256: 107c0827311c41bfc499a50285252b681e957e873df89241c221dfa9fdcdd166
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe User do before do @user = User.new end it "knows its role" do @user.role = 'admin' @user.admin?.should be_true end it "returns its role as a symbol" do @user.role = 'admin' @user.role.should == :admin end it "assigns the role if it is in the list of valid roles" do @user.role = :member @user.role.should == :member end it "does not assign the role if it is not in the list of valid roles" do @user.role = 'admin' @user.role = :superuser @user.role.should == :admin end it "does not allow the role to be mass-assigned" do begin @user.update_attributes(:role => 'admin') rescue Exception => e ensure @user.role.should be_nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zuul-0.1.1 | spec/rails_root/spec/models/user_spec.rb |
zuul-0.1.0 | spec/rails_root/spec/models/user_spec.rb |