factory_girl-preload 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- factory_girl-preload (0.1.0)
4
+ factory_girl-preload (0.1.1)
5
5
  factory_girl (~> 1.3.3)
6
6
 
7
7
  GEM
data/README.rdoc CHANGED
@@ -39,7 +39,7 @@ On <tt>spec/spec_helper.rb</tt> file, make sure that transactional fixtures are
39
39
  config.mock_with :rspec
40
40
  end
41
41
 
42
- Create your fixtures on <tt>spec/support/factories.rb</tt>. You may have something like this:
42
+ Create your factories on <tt>spec/support/factories.rb</tt>. You may have something like this:
43
43
 
44
44
  Factory.sequence :email do |n|
45
45
  "john#{n}@doe.com"
@@ -49,10 +49,6 @@ Create your fixtures on <tt>spec/support/factories.rb</tt>. You may have somethi
49
49
  "john#{n}"
50
50
  end
51
51
 
52
- Factory.sequence :public_key do |n|
53
- File.read(Rails.root.join("spec/fixtures/hash.rsa")) + n.to_s
54
- end
55
-
56
52
  Factory.define :user do |f|
57
53
  f.name "John Doe"
58
54
  f.email { Factory.next(:email) }
@@ -1,3 +1,5 @@
1
+ require 'rspec/core'
2
+
1
3
  RSpec.configure do |config|
2
4
  config.include Factory::Preload::Helpers
3
5
  config.before(:suite) do
@@ -8,4 +10,4 @@ RSpec.configure do |config|
8
10
  config.before(:each) do
9
11
  Factory::Preload.reload_factories
10
12
  end
11
- end
13
+ end
@@ -3,7 +3,7 @@ class Factory
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 0
6
+ PATCH = 1
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
8
  end
9
9
  end
@@ -31,7 +31,9 @@ class Factory
31
31
 
32
32
  def self.reload_factories
33
33
  factories.each do |class_name, group|
34
- group.values.each {|factory| factory.reload}
34
+ group.each do |name, factory|
35
+ factories[class_name][name] = factory.class.find(factory.id)
36
+ end
35
37
  end
36
38
  end
37
39
  end
@@ -45,6 +45,11 @@ describe Factory::Preload do
45
45
  Factory::Preload.reload_factories
46
46
  end
47
47
 
48
+ it "freezes object" do
49
+ users(:john).destroy
50
+ users(:john).should be_frozen
51
+ end
52
+
48
53
  it "updates invitation count" do
49
54
  users(:john).increment(:invitations)
50
55
  users(:john).save
@@ -53,6 +58,7 @@ describe Factory::Preload do
53
58
 
54
59
  it "reloads factory" do
55
60
  users(:john).invitations.should == 0
61
+ users(:john).should_not be_frozen
56
62
  end
57
63
  end
58
64
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: factory_girl-preload
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nando Vieira
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-11 00:00:00 Z
13
+ date: 2011-06-08 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: factory_girl
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  requirements: []
131
131
 
132
132
  rubyforge_project:
133
- rubygems_version: 1.7.2
133
+ rubygems_version: 1.8.5
134
134
  signing_key:
135
135
  specification_version: 3
136
136
  summary: Preload factories (Factory Girl) just like fixtures. It will be easy and, probably, faster!