rspec-set 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/rspec-set.rb +2 -2
- data/lib/version.rb +1 -1
- data/spec/rspec_set_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59acff67d9ebe8be0e2548b0dfb11561bb94e5ae
|
4
|
+
data.tar.gz: 47954361978a4f5d2cf7e276131a73c8b2e12685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba5fc31ad4fc71bf42ef6eb8956924b489d080d92f168fb0b685ccd16b011d2b535f6ac29fbdd7fffa5fc976207d442bcf82dc5c6f1acef63d9da1bc08421dd
|
7
|
+
data.tar.gz: ff050073258e7e98f5ae444a525a8f2d59f05ec2d9605662f37e67a631c7ebe20f93db69547288e33d83e51accb69d806eda4833675ab793a34728bd6eca0ae0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# rspec-set CHANGELOG
|
2
2
|
|
3
|
+
## 0.1.2
|
4
|
+
|
5
|
+
* fix reload destroy models by [@pcreux][]
|
6
|
+
|
3
7
|
## 0.1.1
|
4
8
|
|
5
9
|
* add test suite by [@loganhasson][] (PR [#4][])
|
@@ -22,4 +26,5 @@
|
|
22
26
|
[#4]: https://github.com/pcreux/rspec-set/issues/4
|
23
27
|
[#5]: https://github.com/pcreux/rspec-set/issues/5
|
24
28
|
[@21croissants]: https://github.com/21croissants
|
25
|
-
[@loganhasson]: https://github.com/loganhasson
|
29
|
+
[@loganhasson]: https://github.com/loganhasson
|
30
|
+
[@pcreux]: https://github.com/pcreux
|
data/lib/rspec-set.rb
CHANGED
@@ -26,8 +26,8 @@ module RSpec
|
|
26
26
|
|
27
27
|
if model.is_a?(ActiveRecord::Base)
|
28
28
|
if model.destroyed?
|
29
|
-
#
|
30
|
-
model.class.find(model.id)
|
29
|
+
# Reset destroyed model
|
30
|
+
self.class.send(:class_variable_set, "@@__rspec_set_#{variable_name}".to_sym, model.class.find(model.id))
|
31
31
|
elsif !model.new_record?
|
32
32
|
# Reload saved model
|
33
33
|
model.reload
|
data/lib/version.rb
CHANGED
data/spec/rspec_set_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe 'with a destroyed ActiveRecord model' do
|
|
35
35
|
ActiveRecordClassExample.create(name: 'Alfred', age: 77)
|
36
36
|
end
|
37
37
|
|
38
|
-
it 'allows us to
|
38
|
+
it 'allows us to destroy a model' do
|
39
39
|
my_destroyed_object.destroy
|
40
40
|
expect(
|
41
41
|
ActiveRecordClassExample.find_by(id: my_destroyed_object.id)
|
@@ -43,7 +43,7 @@ describe 'with a destroyed ActiveRecord model' do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'reloads a destroyed model' do
|
46
|
-
expect(my_destroyed_object.name).to eq('Alfred')
|
46
|
+
expect(my_destroyed_object.reload.name).to eq('Alfred')
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -162,4 +162,4 @@ describe 'deleting an object' do
|
|
162
162
|
expect(subject.name).to eq('apple')
|
163
163
|
end
|
164
164
|
end
|
165
|
-
end
|
165
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philippe Creux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|