Skip to content

Commit a78264a

Browse files
authored
Merge pull request #185 from skukx/184-cant-modify-frozen-hash
Allow to really_destroy! users
2 parents 1389785 + d1ce68e commit a78264a

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

app/models/spree/user.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def set_login
4646
end
4747

4848
def scramble_email_and_password
49+
return true if destroyed?
50+
4951
self.email = SecureRandom.uuid + "@example.net"
5052
self.login = email
5153
self.password = SecureRandom.hex(8)

spec/models/user_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@
7878
end
7979
end
8080

81+
describe '#really_destroy!' do
82+
let(:user) { create(:user) }
83+
84+
it 'removes the record from the database' do
85+
user.really_destroy!
86+
expect(Spree::User.with_deleted.exists?(id: user.id)).to eql false
87+
end
88+
end
89+
8190
describe "confirmable" do
8291
it "is confirmable if the confirmable option is enabled" do
8392
set_confirmable_option(true)

0 commit comments

Comments
 (0)