Skip to content

Commit

Permalink
Fixes Spree::User model specs for the new fixed behaviour of Spree::U…
Browse files Browse the repository at this point in the history
…serMethods

spree/spree#7430 in spree fixed user deletion
validation and this caused some outdated specs in spree_auth_devise to
fail.
  • Loading branch information
damianlegawiec authored and hishammalik committed Feb 10, 2018
1 parent e81951f commit 2534962
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spec/models/user_spec.rb
Expand Up @@ -15,8 +15,8 @@
end

context '#destroy' do
it 'will soft delete' do
order = build(:order, completed_at: Time.now)
it 'will soft delete with uncompleted orders' do
order = build(:order)
order.save
user = order.user
user.destroy
Expand All @@ -28,6 +28,13 @@
expect(Spree::Order.where(user_id: user.id).first).to eq(order)
end

it 'will not soft delete with completed orders' do
order = build(:order, completed_at: Time.now)
order.save
user = order.user
expect { user.destroy }.to raise_error(Spree::Core::DestroyWithOrdersError)
end

it 'will allow users to register later with same email address as previously deleted account' do
user1 = build(:user)
user1.save
Expand Down

0 comments on commit 2534962

Please sign in to comment.