acts_as 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Gemfile +1 -1
- data/lib/acts_as/version.rb +1 -1
- data/lib/acts_as.rb +1 -1
- data/spec/acts_as_spec.rb +10 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3397b4833d35ad1b25dc61eca74ce2e5f195be35
|
4
|
+
data.tar.gz: 666e31cb4d083c4dcbeca68248f0634e103cdb71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abfabc7cc32d04053b13b586de0e681de2c778038b9828d6f22e2ab07fc419e7efd4f9781596a2e3b5ec0ce3362d526b32ae2f008d0a535570c52350c17dbc8e
|
7
|
+
data.tar.gz: 8747b446a37e5e96a17bc69696114ddfc6502266c370f4cde47860bed133819d3ac5b4102c7497431ff200a8ad167b5c04cea6543bb5165dc811f1b68cd5afa4
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
CHANGED
data/lib/acts_as/version.rb
CHANGED
data/lib/acts_as.rb
CHANGED
@@ -35,7 +35,7 @@ module ActsAs
|
|
35
35
|
belongs_to(association, **options.merge(autosave: true))
|
36
36
|
define_method(association) do |*args|
|
37
37
|
acted = super(*args) || send("build_#{association}", *args)
|
38
|
-
acted.save
|
38
|
+
acted.save if persisted? && acted.new_record?
|
39
39
|
acted
|
40
40
|
end
|
41
41
|
|
data/spec/acts_as_spec.rb
CHANGED
@@ -61,6 +61,16 @@ describe ActsAs do
|
|
61
61
|
}.to change(RebelProfile, :count).by(1)
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
describe 'when host model is not persisted' do
|
66
|
+
let(:rebel) { Rebel.new(name: "Bail", clan_name: "Oranga") }
|
67
|
+
|
68
|
+
it 'does not persist the acted model' do
|
69
|
+
expect {
|
70
|
+
rebel.profile.should_not be_persisted
|
71
|
+
}.to_not change(RebelProfile, :count)
|
72
|
+
end
|
73
|
+
end
|
64
74
|
end
|
65
75
|
|
66
76
|
describe 'with' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winfred
|
@@ -46,6 +46,7 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- .gitignore
|
49
|
+
- .rspec
|
49
50
|
- Gemfile
|
50
51
|
- LICENSE.txt
|
51
52
|
- README.md
|