spec/models/user_spec.rb in marty-2.3.15 vs spec/models/user_spec.rb in marty-2.4.0
- old
+ new
@@ -2,15 +2,15 @@
module Marty
describe User do
before(:each) do
Rails.configuration.marty.system_account =
- system_user.login
+ UserHelpers.system_user.login
end
let (:tuser) {
- create_user('other_user')
+ UserHelpers.create_user('other_user')
}
describe "validations" do
it "should require login, firstname and lastname" do
user = User.new
@@ -20,33 +20,33 @@
expect(user.errors[:lastname].any?).to be true
end
it "should require unique login" do
expect(Mcfly.whodunnit).to_not be_nil
- user = system_user.dup
+ user = UserHelpers.system_user.dup
expect(user).to_not be_valid
expect(user.errors[:login].to_s).to include('already been taken')
user.login = 'marty2'
expect(user).to be_valid
end
it "should not allow Gemini account to be de-activated" do
- user = system_user
+ user = UserHelpers.system_user
user.active = false
expect(user).to_not be_valid
expect(user.errors[:base].to_s).
to include('application system account cannot be deactivated')
end
it "should not allow accounts to be deleted" do
- user = system_user
+ user = UserHelpers.system_user
user.destroy
expect(user.destroyed?).to be false
end
it "should not allow user managers to edit the Gemini account" do
Mcfly.whodunnit = tuser
- user = system_user
+ user = UserHelpers.system_user
allow_any_instance_of(Marty::User).to receive(:user_manager_only).
and_return(true)
user.firstname = 'Testing'
expect(user).to_not be_valid
expect(user.errors[:base].to_s).