Skip to content

Commit

Permalink
Update spec
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Dec 5, 2016
1 parent 861b7f6 commit d252fff
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions spec/models/users/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,24 @@
end
end

it "should set suspended timestamp upon creation if signups need approval and the user is not an admin" do
allow(Setting).to receive(:user_signup).and_return(:needs_approval)
@user = FactoryGirl.create(:user, suspended_at: nil)
expect(@user).to be_suspended
end
describe '#check_if_needs_approval' do
it "should set suspended timestamp upon creation if signups need approval and the user is not an admin" do
allow(Setting).to receive(:user_signup).and_return(:needs_approval)
@user = FactoryGirl.build(:user, suspended_at: nil)

@user.check_if_needs_approval

expect(@user).to be_suspended
end

it "should not set suspended timestamp upon creation if signups need approval and the user is an admin" do
allow(Setting).to receive(:user_signup).and_return(:needs_approval)
@user = FactoryGirl.create(:user, admin: true, suspended_at: nil)
expect(@user).not_to be_suspended
it "should not set suspended timestamp upon creation if signups need approval and the user is an admin" do
allow(Setting).to receive(:user_signup).and_return(:needs_approval)
@user = FactoryGirl.build(:user, admin: true, suspended_at: nil)

@user.check_if_needs_approval

expect(@user).not_to be_suspended
end
end

context "scopes" do
Expand Down

0 comments on commit d252fff

Please sign in to comment.