acts_as 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbeabb43ed80dd4e50b939377b9a089c639460c9
4
- data.tar.gz: 90a45695199493b9e374935120922ddaead80d3b
3
+ metadata.gz: 3397b4833d35ad1b25dc61eca74ce2e5f195be35
4
+ data.tar.gz: 666e31cb4d083c4dcbeca68248f0634e103cdb71
5
5
  SHA512:
6
- metadata.gz: cbea4d58639ee1b234f882847627cdd9b0b6543704f968766fdcd2021f484fb8e6c869a89d4903fd6a2c7001dc37f3a5aff37b89074bbd5df4b1eaafed1ddaa4
7
- data.tar.gz: 6a51f37065b9bd9828fcf2ae560bbb562b71a9c315e5b68b0cb2ca6755ae7e68bcba070a995742e9c9c5aa79481b666fd0f733e899be394ce1f0a841b79ddd8d
6
+ metadata.gz: abfabc7cc32d04053b13b586de0e681de2c778038b9828d6f22e2ab07fc419e7efd4f9781596a2e3b5ec0ce3362d526b32ae2f008d0a535570c52350c17dbc8e
7
+ data.tar.gz: 8747b446a37e5e96a17bc69696114ddfc6502266c370f4cde47860bed133819d3ac5b4102c7497431ff200a8ad167b5c04cea6543bb5165dc811f1b68cd5afa4
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ ruby '2.0.0'
4
4
  # Specify your gem's dependencies in acts_as.gemspec
5
5
  gemspec
6
6
 
7
- gem 'activerecord'
7
+ gem 'activerecord', '~> 3.2'
8
8
 
9
9
  group :test do
10
10
  gem 'pry'
@@ -1,3 +1,3 @@
1
1
  module ActsAs
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
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(validate: false) unless acted.persisted?
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.0
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