act_as_releasable 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,13 +40,10 @@ module ActAsReleasable
40
40
  end
41
41
 
42
42
  def release_candidate
43
- clone.tap do
44
- self.releasable_collections.each do |collection|
45
- send(collection).clear
46
- end
47
- self.attributes = releasable_candidate.try(:candidate_attributes) || {}
43
+ self.class.new.tap do |clone|
44
+ clone.attributes = releasable_candidate.try(:candidate_attributes) || {}
48
45
  releasable_candidate_items.each do |candidate_item|
49
- send(candidate_item.collection_name).build candidate_item.candidate_attributes
46
+ clone.send(candidate_item.collection_name).build candidate_item.candidate_attributes
50
47
  end
51
48
  end
52
49
  end
@@ -1,3 +1,3 @@
1
1
  module ActAsReleasable
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -89,4 +89,15 @@ describe "the creation of a release candidate" do
89
89
  it { phantoms.should have_changes_to_be_approved }
90
90
  end
91
91
 
92
+ describe "the calling of the release_candidate method" do
93
+ it "should not clear any collection" do
94
+ jazz_all_stars.players.build attributes_for(:gasper)
95
+ jazz_all_stars.generate_new_candidate
96
+
97
+ jazz_all_stars.release_candidate
98
+
99
+ jazz_all_stars.reload.should have(3).players
100
+ end
101
+ end
102
+
92
103
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: act_as_releasable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-17 00:00:00.000000000 Z
12
+ date: 2012-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec