lib/generators/devisable/templates/spec/models/user_spec.erb in devisable-0.1.1 vs lib/generators/devisable/templates/spec/models/user_spec.erb in devisable-0.1.2

- old
+ new

@@ -6,20 +6,18 @@ :name => 'Admin' }) @role2 = Role.new({ :name => 'SuperAdmin' }) - @role.save - @role2.save - @user = User.new({:email => 'fred@testsite.com'}) - @user2 = User.new({:email => 'fred2@testsite.com',:username => 'fred2'}) - @user3 = User.new({:username => 'fred3'}) - @user4 = User.new() + @role.save! + @role2.save! + @user = User.new({:email => 'fred@testsite.com', :password=>'pwfred'}) + @user2 = User.new({:email => 'fred2@testsite.com',:username => 'fred2', :password=>'fred2pw'}) @user.roles << @role - @user.save + @user.save! @user2.roles << @role2 - @user2.save + @user2.save! end it "should have the role Admin if assigned the Admin Role" do @user.role?('Admin').should be_true end @@ -30,29 +28,16 @@ it "should have username fred@testsite.com if there is no username" do (@user.display_name == 'fred@testsite.com').should be_true end - it "should have username fred if there is a username and an email" do + it "should have username fred2 if there is a username and an email" do (@user2.display_name == 'fred2').should be_true end - it "should have username fred if there is a username and no email" do - @user2.email = '' - (@user2.display_name == 'fred2').should be_true - end - it "should only show Fred2 for the superadmins" do User.superadmins.include?(@user2).should be_true User.superadmins.include?(@user).should be_false - end - - it "should require a username or email" do - @user4.should_not be_valid - end - - it "should be valid with a username" do - @user3.should be_valid end it "should be valid with an email" do @user.should be_valid end