factory_girl-preload 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e77301eb1edb16a785cb0dbcd0d628bbd2081808
4
- data.tar.gz: d1594901d3ed7e85a6175d92c6f71945cfe06eab
3
+ metadata.gz: ab3729f171070e0df3264bee3761fb1204c77076
4
+ data.tar.gz: ce6e84d25feb7922e5aa4a2da6cf9b8147e66c7b
5
5
  SHA512:
6
- metadata.gz: 5dae2a72f6e597ae5e8126cc56f25c34fd12170e5e6ade711b369f7853adca2829268821a72430be83983327cb69018f76ab1d46cc2824d37449bc467c0712cd
7
- data.tar.gz: d24f97ef86de07b1b10f0a623e64d834408a33fe0677ddb5d591ce034abd17e2ab3d4ccc99bbe2ed18dcbbcac0667042c48a388ad817d34a4500adf72c5d3795
6
+ metadata.gz: c363f8016ab5703304da1e83712e5e0ce62447465c49c226920fb2229c7e0616bfadbb8bbc2e3d5aa15aa29d8f3225ea7b6a2de6ed5745ff7af28b777bc0f998
7
+ data.tar.gz: 58ae144f6f9c5211d7d8e566d2eee5b9b199dc2faae7b1aa48f45439756df6f285921e614e4be35a93135ef5a4f8a47e1abe703dffaa66a3378ebaa80c8a1c3d
@@ -1,69 +1,89 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- factory_girl-preload (2.1.0)
4
+ factory_girl-preload (2.1.1)
5
5
  factory_girl (>= 3.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (4.0.3)
11
- activesupport (= 4.0.3)
12
- builder (~> 3.1.0)
13
- erubis (~> 2.7.0)
10
+ actionpack (4.1.0)
11
+ actionview (= 4.1.0)
12
+ activesupport (= 4.1.0)
14
13
  rack (~> 1.5.2)
15
14
  rack-test (~> 0.6.2)
16
- activemodel (4.0.3)
17
- activesupport (= 4.0.3)
18
- builder (~> 3.1.0)
19
- activerecord (4.0.3)
20
- activemodel (= 4.0.3)
21
- activerecord-deprecated_finders (~> 1.0.2)
22
- activesupport (= 4.0.3)
23
- arel (~> 4.0.0)
24
- activerecord-deprecated_finders (1.0.3)
25
- activesupport (4.0.3)
26
- i18n (~> 0.6, >= 0.6.4)
27
- minitest (~> 4.2)
28
- multi_json (~> 1.3)
15
+ actionview (4.1.0)
16
+ activesupport (= 4.1.0)
17
+ builder (~> 3.1)
18
+ erubis (~> 2.7.0)
19
+ activemodel (4.1.0)
20
+ activesupport (= 4.1.0)
21
+ builder (~> 3.1)
22
+ activerecord (4.1.0)
23
+ activemodel (= 4.1.0)
24
+ activesupport (= 4.1.0)
25
+ arel (~> 5.0.0)
26
+ activesupport (4.1.0)
27
+ i18n (~> 0.6, >= 0.6.9)
28
+ json (~> 1.7, >= 1.7.7)
29
+ minitest (~> 5.1)
29
30
  thread_safe (~> 0.1)
30
- tzinfo (~> 0.3.37)
31
- arel (4.0.2)
32
- atomic (1.1.15)
33
- builder (3.1.4)
31
+ tzinfo (~> 1.1)
32
+ arel (5.0.1.20140414130214)
33
+ ast (1.1.0)
34
+ builder (3.2.2)
34
35
  diff-lcs (1.2.5)
35
36
  erubis (2.7.0)
36
37
  factory_girl (4.4.0)
37
38
  activesupport (>= 3.0.0)
38
39
  i18n (0.6.9)
39
- minitest (4.7.5)
40
- multi_json (1.9.0)
40
+ json (1.8.1)
41
+ minitest (5.3.3)
41
42
  mysql2 (0.3.15)
43
+ parser (2.1.7)
44
+ ast (~> 1.1)
45
+ slop (~> 3.4, >= 3.4.5)
42
46
  rack (1.5.2)
43
47
  rack-test (0.6.2)
44
48
  rack (>= 1.0)
45
- railties (4.0.3)
46
- actionpack (= 4.0.3)
47
- activesupport (= 4.0.3)
49
+ railties (4.1.0)
50
+ actionpack (= 4.1.0)
51
+ activesupport (= 4.1.0)
48
52
  rake (>= 0.8.7)
49
53
  thor (>= 0.18.1, < 2.0)
50
- rake (10.1.1)
51
- rspec-core (2.14.8)
52
- rspec-expectations (2.14.5)
53
- diff-lcs (>= 1.1.3, < 2.0)
54
- rspec-mocks (2.14.6)
55
- rspec-rails (2.14.1)
54
+ rainbow (2.0.0)
55
+ rake (10.3.0)
56
+ rspec-collection_matchers (0.0.3)
57
+ rspec-expectations (>= 2.99.0.beta1)
58
+ rspec-core (3.0.0.beta2)
59
+ rspec-support (= 3.0.0.beta2)
60
+ rspec-expectations (3.0.0.beta2)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (= 3.0.0.beta2)
63
+ rspec-mocks (3.0.0.beta2)
64
+ rspec-support (= 3.0.0.beta2)
65
+ rspec-rails (3.0.0.beta2)
56
66
  actionpack (>= 3.0)
57
67
  activemodel (>= 3.0)
58
68
  activesupport (>= 3.0)
59
69
  railties (>= 3.0)
60
- rspec-core (~> 2.14.0)
61
- rspec-expectations (~> 2.14.0)
62
- rspec-mocks (~> 2.14.0)
63
- thor (0.18.1)
64
- thread_safe (0.2.0)
65
- atomic (>= 1.1.7, < 2)
66
- tzinfo (0.3.39)
70
+ rspec-collection_matchers
71
+ rspec-core (= 3.0.0.beta2)
72
+ rspec-expectations (= 3.0.0.beta2)
73
+ rspec-mocks (= 3.0.0.beta2)
74
+ rspec-support (= 3.0.0.beta2)
75
+ rspec-support (3.0.0.beta2)
76
+ slop (3.5.0)
77
+ thor (0.19.1)
78
+ thread_safe (0.3.3)
79
+ transpec (1.10.4)
80
+ activesupport (~> 4.0)
81
+ bundler (~> 1.3)
82
+ json (~> 1.8)
83
+ parser (>= 2.1.6, < 3.0)
84
+ rainbow (>= 1.99.1, < 3.0)
85
+ tzinfo (1.1.0)
86
+ thread_safe (~> 0.1)
67
87
 
68
88
  PLATFORMS
69
89
  ruby
@@ -73,4 +93,5 @@ DEPENDENCIES
73
93
  activerecord
74
94
  factory_girl-preload!
75
95
  mysql2
76
- rspec-rails
96
+ rspec-rails (= 3.0.0.beta2)
97
+ transpec
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency "factory_girl", ">= 3.0"
21
21
  s.add_development_dependency "activerecord"
22
22
  s.add_development_dependency "actionpack"
23
- s.add_development_dependency "rspec-rails"
23
+ s.add_development_dependency "rspec-rails", "3.0.0.beta2"
24
+ s.add_development_dependency "transpec"
24
25
  s.add_development_dependency "mysql2"
25
26
  end
@@ -15,7 +15,7 @@ module FactoryGirl
15
15
 
16
16
  class_eval <<-RUBY, __FILE__, __LINE__
17
17
  def #{method_name}(name)
18
- factory(name, ::#{model})
18
+ factory(name, ::#{model.name})
19
19
  end
20
20
  RUBY
21
21
  end
@@ -3,7 +3,7 @@ module FactoryGirl
3
3
  module Version
4
4
  MAJOR = 2
5
5
  MINOR = 1
6
- PATCH = 0
6
+ PATCH = 1
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
8
  end
9
9
  end
@@ -6,16 +6,16 @@ describe FactoryGirl::Preload do
6
6
  it "queues preloader block" do
7
7
  block = proc {}
8
8
  FactoryGirl.preload(&block)
9
- FactoryGirl::Preload.preloaders.should include(block)
9
+ expect(FactoryGirl::Preload.preloaders).to include(block)
10
10
  end
11
11
 
12
12
  it "should lazy load all factories, loading only when used" do
13
- FactoryGirl::Preload.record_ids['User'][:john].should eq(1)
14
- FactoryGirl::Preload.factories['User'][:john].should be_nil
13
+ expect(FactoryGirl::Preload.record_ids['User'][:john]).to eq(1)
14
+ expect(FactoryGirl::Preload.factories['User'][:john]).to be_nil
15
15
 
16
16
  user = users(:john)
17
17
 
18
- FactoryGirl::Preload.factories['User'][:john].should eq(user)
18
+ expect(FactoryGirl::Preload.factories['User'][:john]).to eq(user)
19
19
  end
20
20
 
21
21
  it "injects model methods" do
@@ -23,19 +23,19 @@ describe FactoryGirl::Preload do
23
23
  end
24
24
 
25
25
  it "returns :john factory for User model" do
26
- users(:john).should be_an(User)
26
+ expect(users(:john)).to be_an(User)
27
27
  end
28
28
 
29
29
  it "returns :ruby factory for Skill model" do
30
- skills(:ruby).should be_a(Skill)
30
+ expect(skills(:ruby)).to be_a(Skill)
31
31
  end
32
32
 
33
33
  it "returns :my factory for Preload model" do
34
- preloads(:my).should be_a(Preload)
34
+ expect(preloads(:my)).to be_a(Preload)
35
35
  end
36
36
 
37
37
  it "reuses existing factories" do
38
- skills(:ruby).user.should == users(:john)
38
+ expect(skills(:ruby).user).to eq(users(:john))
39
39
  end
40
40
 
41
41
  it "raises error for missing factories" do
@@ -49,17 +49,17 @@ describe FactoryGirl::Preload do
49
49
 
50
50
  context "removes records" do
51
51
  it "with deletion" do
52
- User.count.should == 1
52
+ expect(User.count).to eq(1)
53
53
  FactoryGirl::Preload.clean_with = :deletion
54
54
  FactoryGirl::Preload.clean
55
- User.count.should == 0
55
+ expect(User.count).to eq(0)
56
56
  end
57
57
 
58
58
  it "with truncation" do
59
- User.count.should == 1
59
+ expect(User.count).to eq(1)
60
60
  FactoryGirl::Preload.clean_with = :truncation
61
61
  FactoryGirl::Preload.clean
62
- User.count.should == 0
62
+ expect(User.count).to eq(0)
63
63
  end
64
64
  end
65
65
 
@@ -75,18 +75,18 @@ describe FactoryGirl::Preload do
75
75
 
76
76
  it "freezes object" do
77
77
  users(:john).destroy
78
- users(:john).should be_frozen
78
+ expect(users(:john)).to be_frozen
79
79
  end
80
80
 
81
81
  it "updates invitation count" do
82
82
  users(:john).increment(:invitations)
83
83
  users(:john).save
84
- users(:john).invitations.should == 1
84
+ expect(users(:john).invitations).to eq(1)
85
85
  end
86
86
 
87
87
  it "reloads factory" do
88
- users(:john).invitations.should == 0
89
- users(:john).should_not be_frozen
88
+ expect(users(:john).invitations).to eq(0)
89
+ expect(users(:john)).not_to be_frozen
90
90
  end
91
91
  end
92
92
  end
@@ -15,6 +15,7 @@ module RSpec
15
15
  class Application < ::Rails::Application
16
16
  config.root = File.dirname(__FILE__) + "/support/app"
17
17
  config.active_support.deprecation = :log
18
+ config.eager_load = false
18
19
  # config.active_record.logger = Logger.new(STDOUT)
19
20
  end
20
21
  end
@@ -0,0 +1,3 @@
1
+ class Category < ActiveRecord::Base
2
+ has_and_belongs_to_many :users
3
+ end
@@ -1,3 +1,4 @@
1
1
  class User < ActiveRecord::Base
2
2
  has_many :skills
3
+ has_and_belongs_to_many :categories
3
4
  end
@@ -3,6 +3,8 @@ ActiveRecord::Schema.define(:version => 0) do
3
3
  drop_table :users
4
4
  drop_table :skills
5
5
  drop_table :preloads
6
+ drop_table :categories
7
+ drop_table :categories_users
6
8
  rescue Exception => e
7
9
  end
8
10
 
@@ -21,4 +23,12 @@ ActiveRecord::Schema.define(:version => 0) do
21
23
  create_table :skills do |t|
22
24
  t.references :user
23
25
  end
26
+
27
+ create_table :categories do |t|
28
+ end
29
+
30
+ create_table :categories_users, :id => false do |t|
31
+ t.references :category
32
+ t.references :user
33
+ end
24
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_girl-preload
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_girl
@@ -54,6 +54,20 @@ dependencies:
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.0.beta2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 3.0.0.beta2
69
+ - !ruby/object:Gem::Dependency
70
+ name: transpec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -103,6 +117,7 @@ files:
103
117
  - lib/factory_girl/preload/version.rb
104
118
  - spec/factory_girl/preload_spec.rb
105
119
  - spec/spec_helper.rb
120
+ - spec/support/app/app/models/category.rb
106
121
  - spec/support/app/app/models/preload.rb
107
122
  - spec/support/app/app/models/skill.rb
108
123
  - spec/support/app/app/models/user.rb
@@ -133,4 +148,13 @@ signing_key:
133
148
  specification_version: 4
134
149
  summary: Preload factories (Factory Girl) just like fixtures. It will be easy and,
135
150
  probably, faster!
136
- test_files: []
151
+ test_files:
152
+ - spec/factory_girl/preload_spec.rb
153
+ - spec/spec_helper.rb
154
+ - spec/support/app/app/models/category.rb
155
+ - spec/support/app/app/models/preload.rb
156
+ - spec/support/app/app/models/skill.rb
157
+ - spec/support/app/app/models/user.rb
158
+ - spec/support/app/config/database.yml
159
+ - spec/support/app/db/schema.rb
160
+ - spec/support/factories.rb