fixturease 0.2.8 → 0.2.9
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.
- data/Rakefile +1 -1
- data/bin/fixturease.rb +7 -2
- data/spec/fixturease_spec.rb +7 -2
- metadata +2 -2
data/Rakefile
CHANGED
data/bin/fixturease.rb
CHANGED
@@ -58,11 +58,16 @@ else
|
|
58
58
|
|
59
59
|
class ActiveRecord::Base
|
60
60
|
alias_method :save_orig, :save
|
61
|
+
alias_method :save_orig!, :save!
|
61
62
|
@@fixtures = {}
|
62
63
|
def save
|
63
64
|
returning result=save_orig do
|
64
|
-
|
65
|
-
|
65
|
+
save_for_fixturease
|
66
|
+
end
|
67
|
+
end
|
68
|
+
def save!
|
69
|
+
returning result=save_orig! do
|
70
|
+
save_for_fixturease
|
66
71
|
end
|
67
72
|
end
|
68
73
|
|
data/spec/fixturease_spec.rb
CHANGED
@@ -153,24 +153,29 @@ context "Fixturease" do
|
|
153
153
|
|
154
154
|
specify "should rewrite fixtures from scratch with altered models if load_fixtures! and preserve name" do
|
155
155
|
run_fixturease do |f|
|
156
|
+
# f.puts "@sometest = TestModel.create :title => 'test title'"
|
156
157
|
f.puts "@test = TestModel.create :title => 'test title'"
|
157
158
|
f.puts "exit"
|
158
159
|
f.readline until f.eof?
|
159
160
|
end
|
160
161
|
original_yaml = YAML::load_file("testfixtureaseproject/test/fixtures/test_models.yml")
|
162
|
+
# puts original_yaml.inspect
|
161
163
|
run_fixturease do |f|
|
162
164
|
f.puts "load_fixtures!"
|
163
165
|
f.puts "@test1 = TestModel.find(#{original_yaml['test']['id']})"
|
164
166
|
f.puts "@test1.title = 'new title'"
|
165
167
|
f.puts "@test1.save"
|
168
|
+
# f.puts "@atest1 = TestModel.find(#{original_yaml['atest']['id']})"
|
169
|
+
# f.puts "@atest1.title = 'new title'"
|
170
|
+
# f.puts "@atest1.save!"
|
166
171
|
f.puts "exit"
|
167
172
|
f.readline until f.eof?
|
168
173
|
end
|
169
174
|
new_yaml = YAML::load_file("testfixtureaseproject/test/fixtures/test_models.yml")
|
170
175
|
new_yaml.should_not == original_yaml
|
171
|
-
new_yaml.
|
172
|
-
new_yaml.keys.should_have(0).grep(/^tes1$/)
|
176
|
+
# puts new_yaml.inspect
|
173
177
|
new_yaml['test']['title'].should == 'new title'
|
178
|
+
# new_yaml['atest']['title'].should == 'new title'
|
174
179
|
end
|
175
180
|
|
176
181
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: fixturease
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.2.9
|
7
|
+
date: 2007-02-04 00:00:00 +02:00
|
8
8
|
summary: Easy fixture creation tool
|
9
9
|
require_paths:
|
10
10
|
- lib
|