fixturease 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ desc 'Default: run unit tests.'
7
7
  task :default => :spec
8
8
 
9
9
 
10
- PKG_VERSION="0.2.8"
10
+ PKG_VERSION="0.2.9"
11
11
  PKG_FILES=["bin/fixturease.rb","Rakefile","spec/database.yml","spec/fixturease_spec.rb"]
12
12
 
13
13
  spec = Gem::Specification.new do |s|
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
- @@fixtures[self.class] ||= {}
65
- @@fixtures[self.class][self.id] = self unless self.new_record?
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
 
@@ -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.keys.should_have(1).grep(/^test$/)
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.8
7
- date: 2007-01-31 00:00:00 +02:00
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