secretary-rails 1.0.0.beta5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -0
- data/app/models/secretary/version.rb +1 -1
- data/lib/secretary/gem_version.rb +1 -1
- data/lib/secretary/has_secretary.rb +4 -1
- data/lib/secretary/versioned_attributes.rb +28 -1
- data/spec/factories.rb +1 -1
- data/spec/internal/log/test.log +13768 -0
- data/spec/lib/secretary/dirty_singular_association_spec.rb +2 -4
- data/spec/lib/secretary/versioned_attributes_spec.rb +31 -1
- data/spec/tmp/db/migrate/{20131119033407_create_versions.rb → 20131119071129_create_versions.rb} +0 -0
- metadata +5 -5
@@ -123,8 +123,6 @@ describe "Dirty Singular Association" do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'does not add a new version if nothing has changed' do
|
126
|
-
pending "single associations save versions even if not changed"
|
127
|
-
|
128
126
|
image_attributes = {
|
129
127
|
"id" => image.id,
|
130
128
|
"title" => "Superman"
|
@@ -155,7 +153,7 @@ describe "Dirty Singular Association" do
|
|
155
153
|
end
|
156
154
|
|
157
155
|
it 'is false if the association has not changed' do
|
158
|
-
pending "
|
156
|
+
pending "association_changed? is always considered changed when assigning"
|
159
157
|
|
160
158
|
story.image = image
|
161
159
|
story.image_changed?.should eq true
|
@@ -239,7 +237,7 @@ describe "Dirty Singular Association" do
|
|
239
237
|
end
|
240
238
|
|
241
239
|
it 'is false if the association has not changed' do
|
242
|
-
pending "
|
240
|
+
pending "association_changed? is always considered changed when assigning"
|
243
241
|
|
244
242
|
image.story = story
|
245
243
|
image.story_changed?.should eq true
|
@@ -14,15 +14,45 @@ describe Secretary::VersionedAttributes do
|
|
14
14
|
Person.versioned_attributes.should_not include "name"
|
15
15
|
Person.versioned_attributes.should_not include "ethnicity"
|
16
16
|
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '::versioned_attributes=' do
|
20
|
+
it 'sets the versioned attributes' do
|
21
|
+
original = Person.versioned_attributes
|
22
|
+
|
23
|
+
Person.versioned_attributes = ["name"]
|
24
|
+
Person.versioned_attributes.should eq ["name"]
|
25
|
+
|
26
|
+
Person.versioned_attributes = original
|
27
|
+
end
|
17
28
|
|
18
29
|
it "raises ArgumentError if any of the attributes aren't strings" do
|
19
|
-
|
30
|
+
lambda {
|
20
31
|
Person.versioned_attributes = [:a, :b, "c"]
|
21
32
|
}.should raise_error ArgumentError
|
22
33
|
end
|
23
34
|
end
|
24
35
|
|
25
36
|
|
37
|
+
describe '::unversioned_attributes=' do
|
38
|
+
it "removes the attributes from the versioned attributes" do
|
39
|
+
original = Person.versioned_attributes
|
40
|
+
|
41
|
+
Person.versioned_attributes = ["name", "ethnicity"]
|
42
|
+
Person.unversioned_attributes = ["name"]
|
43
|
+
Person.versioned_attributes.should eq ["ethnicity"]
|
44
|
+
|
45
|
+
Person.versioned_attributes = original
|
46
|
+
end
|
47
|
+
|
48
|
+
it "raises ArgumentError if any of the attributes aren't strings" do
|
49
|
+
lambda {
|
50
|
+
Person.unversioned_attributes = [:a, :b, "c"]
|
51
|
+
}.should raise_error ArgumentError
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
26
56
|
describe '#versioned_changes' do
|
27
57
|
let(:person) { create :person }
|
28
58
|
|
data/spec/tmp/db/migrate/{20131119033407_create_versions.rb → 20131119071129_create_versions.rb}
RENAMED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secretary-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Ricker
|
@@ -203,7 +203,7 @@ files:
|
|
203
203
|
- spec/models/secretary/version_spec.rb
|
204
204
|
- spec/spec_helper.rb
|
205
205
|
- spec/support/test_setup.rb
|
206
|
-
- spec/tmp/db/migrate/
|
206
|
+
- spec/tmp/db/migrate/20131119071129_create_versions.rb
|
207
207
|
homepage: https://github.com/scpr/secretary-rails
|
208
208
|
licenses:
|
209
209
|
- MIT
|
@@ -219,9 +219,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
219
219
|
version: '0'
|
220
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
221
|
requirements:
|
222
|
-
- - '
|
222
|
+
- - '>='
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version:
|
224
|
+
version: '0'
|
225
225
|
requirements: []
|
226
226
|
rubyforge_project:
|
227
227
|
rubygems_version: 2.0.3
|
@@ -257,5 +257,5 @@ test_files:
|
|
257
257
|
- spec/models/secretary/version_spec.rb
|
258
258
|
- spec/spec_helper.rb
|
259
259
|
- spec/support/test_setup.rb
|
260
|
-
- spec/tmp/db/migrate/
|
260
|
+
- spec/tmp/db/migrate/20131119071129_create_versions.rb
|
261
261
|
has_rdoc:
|