Skip to content

Commit

Permalink
finish rolling back initial implementation of user registration
Browse files Browse the repository at this point in the history
  • Loading branch information
fermion committed Jan 14, 2024
1 parent 5a57d12 commit bca7500
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
1 change: 0 additions & 1 deletion spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
after(:build) do |user, options|
# a current company is required for the user to be valid
# unless one is already set, create one
next if user.email_validation_pending?
next if user.current_company.present?

if user.memberships.length == 1
Expand Down
20 changes: 5 additions & 15 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,12 @@

RSpec.describe User, type: :model do
context "validations" do
context "when user has a validated email address" do
it "requires a current company" do
user = build(:user)
user.update(current_company: nil)
expect(user).to_not be_valid
end
end

context "when user does not have a validated email address" do
it "does not require a current company" do
user = build(:user, :needs_validation)
user.update(current_company: nil, current_company_id: nil)
expect(user).to_not be_valid
end
it "requires a current company" do
user = build(:user)
user.update(current_company: nil)
expect(user).to_not be_valid
end

it "requires a unique email" do
user = create(:membership).user
other_user = build(:membership, user: build(:user, email: user.email)).user
Expand Down

0 comments on commit bca7500

Please sign in to comment.