cucumber_factory 1.11.7 → 1.11.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d28de517891242c79d8f64c23f92e6a6bc322f12
4
- data.tar.gz: 532c04a63d0c234063abf1611bc119eaef88c0eb
3
+ metadata.gz: 2474f1242ac52bc7d8ed0e36fcf51f5fea0301c9
4
+ data.tar.gz: 3cbeb16d2fe2cd2038bc22e937046af0f0743e53
5
5
  SHA512:
6
- metadata.gz: b1b9b07fe1e6db10e9ac006e1806ef4d132b35ccf8400094b29d20ced5db682aa5088ec43d55ed8554cc7f9191313ab662de5010cdde66d8ba95f96b09f53eed
7
- data.tar.gz: 7774e3ae88b88d31f051a34d9ba9f342fce6284a6828dcc38aeacae52c769c83a7830809e8a1f966521a765a0d24f36e6cc62b4ec0d742dcad721fc513e3b7de
6
+ metadata.gz: 0cea20126d458263a37d369acefc48855cf156d92a81d6b6776373d0c7fdcc4982646166c747afdbd17cdb0428da6cf39114f19c3d535cc25014ed5b349ef0f1
7
+ data.tar.gz: 47f468e206ea8fc20ef02ae343cc048bf47e794f4e9549cf5e474f9919f9bcbbf45007200fa957e8dfd966003b3e79a34c85e454c50e5c7ba707c40fe533cbd1
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ pkg
5
5
  .idea
6
6
  .rvmrc
7
7
  log/*.log
8
+ spec/support/database.yml
data/.travis.yml CHANGED
@@ -24,9 +24,7 @@ matrix:
24
24
  install:
25
25
  # Replace default Travis CI bundler script with a version that doesn't
26
26
  # explode when lockfile doesn't match recently bumped version
27
- - gem uninstall bundler -x -I
28
- - gem install bundler --version='=1.12.5'
29
- - bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
27
+ - bundle install --no-deployment --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
30
28
 
31
29
  before_script:
32
30
  - mysql -e 'create database IF NOT EXISTS cucumber_factory_test;'
data/README.md CHANGED
@@ -16,7 +16,7 @@ To create a new record with default attributes:
16
16
  Given there is a movie
17
17
  ```
18
18
 
19
- To create the record, cucumber_factory will call [`Movie.make`](http://github.com/notahat/machinist), [`Factory.create(:movie)`](http://github.com/thoughtbot/factory_girl), [`Movie.create!`](http://apidock.com/rails/ActiveRecord/Persistence/ClassMethods/create%21) or `Movie.new`, depending on what's available.
19
+ To create the record, cucumber_factory will call [`Movie.make`](http://github.com/notahat/machinist), [`Factory.create(:movie)`](http://github.com/thoughtbot/factory_bot), [`Movie.create!`](http://apidock.com/rails/ActiveRecord/Persistence/ClassMethods/create%21) or `Movie.new`, depending on what's available.
20
20
 
21
21
  To create a new record with attributes set, you can say:
22
22
 
@@ -74,15 +74,15 @@ Note that in the example above, "Before Sunrise" is only a name you can use to r
74
74
  Support for popular factory gems
75
75
  --------------------------------
76
76
 
77
- [Machinist blueprints](http://github.com/notahat/machinist) and [factory_girl factories](http://github.com/thoughtbot/factory_girl) will be used when available.
77
+ [Machinist blueprints](http://github.com/notahat/machinist) and [factory_bot factories](http://github.com/thoughtbot/factory_bot) will be used when available.
78
78
 
79
- You can use a [FactoryGirl child factory](https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#inheritance) or [Machinist named blueprint](https://github.com/notahat/machinist/tree/1.0-maintenance#named-blueprints) by putting the variant name in parentheses:
79
+ You can use a [FactoryBot child factory](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#inheritance) or [Machinist named blueprint](https://github.com/notahat/machinist/tree/1.0-maintenance#named-blueprints) by putting the variant name in parentheses:
80
80
 
81
81
  ```cucumber
82
82
  Given there is a movie (comedy) with the title "Groundhog Day"
83
83
  ```
84
84
 
85
- You can use [FactoryGirl traits](https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#traits) by putting the traits in parentheses, as a comma-separated list:
85
+ You can use [FactoryBot traits](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#traits) by putting the traits in parentheses, as a comma-separated list:
86
86
 
87
87
  ```cucumber
88
88
  Given there is a movie (moody, dark) with the title "Interstellar"
@@ -1,7 +1,7 @@
1
1
  module Cucumber
2
2
  class Factory
3
3
 
4
- # wraps machinist / factory_girl / ruby object logic
4
+ # wraps machinist / factory_bot / ruby object logic
5
5
 
6
6
  class BuildStrategy
7
7
 
@@ -17,8 +17,8 @@ module Cucumber
17
17
  variants = []
18
18
  end
19
19
 
20
- if factory_girl_strategy = factory_girl_strategy(underscored_model_name, variants)
21
- factory_girl_strategy
20
+ if factory_bot_strategy = factory_bot_strategy(underscored_model_name, variants)
21
+ factory_bot_strategy
22
22
  else
23
23
  model_class = underscored_model_name.camelize.constantize
24
24
  machinist_strategy(model_class, variants) ||
@@ -29,14 +29,17 @@ module Cucumber
29
29
 
30
30
  private
31
31
 
32
- def factory_girl_strategy(factory_name, variants)
33
- return unless defined?(::FactoryGirl)
32
+ def factory_bot_strategy(factory_name, variants)
33
+ factory_class = ::FactoryBot if defined?(FactoryBot)
34
+ factory_class ||= ::FactoryGirl if defined?(FactoryGirl)
35
+ return unless factory_class
36
+
34
37
  variants = variants.map(&:to_sym)
35
38
  factory_name = factory_name.to_s.underscore.gsub('/', '_').to_sym
36
39
 
37
- factory = ::FactoryGirl.factories[factory_name]
40
+ factory = factory_class.factories[factory_name]
38
41
 
39
- if factory.nil? && variants.present? && factory = ::FactoryGirl.factories[variants[0]]
42
+ if factory.nil? && variants.present? && factory = factory_class.factories[variants[0]]
40
43
  factory_name, *variants = variants
41
44
  end
42
45
 
@@ -47,7 +50,7 @@ module Cucumber
47
50
  args = []
48
51
  args += variants
49
52
  args << attributes
50
- ::FactoryGirl.create(factory_name, *args)
53
+ factory_class.create(factory_name, *args)
51
54
  end
52
55
  end
53
56
 
@@ -1,3 +1,3 @@
1
1
  module CucumberFactory
2
- VERSION = '1.11.7'
2
+ VERSION = '1.11.8'
3
3
  end
@@ -8,10 +8,10 @@ describe Cucumber::Factory::BuildStrategy do
8
8
 
9
9
  describe '.from_prose' do
10
10
 
11
- context 'when describing a factory girl factory' do
11
+ context 'when describing a factory_bot factory' do
12
12
 
13
13
  it 'returns a strategy corresponding to the factories model' do
14
- FactoryGirl.stub_factories :job_offer => JobOffer
14
+ FactoryBot.stub_factories :job_offer => JobOffer
15
15
  strategy = subject.from_prose('job offer', nil)
16
16
 
17
17
  strategy.should be_a(described_class)
@@ -19,7 +19,7 @@ describe Cucumber::Factory::BuildStrategy do
19
19
  end
20
20
 
21
21
  it 'uses the variant for the factory name if present' do
22
- FactoryGirl.stub_factories :job_offer => JobOffer
22
+ FactoryBot.stub_factories :job_offer => JobOffer
23
23
  strategy = subject.from_prose('foo', '(job offer)')
24
24
 
25
25
  strategy.should be_a(described_class)
@@ -28,7 +28,7 @@ describe Cucumber::Factory::BuildStrategy do
28
28
 
29
29
  end
30
30
 
31
- context 'when describing a non factory girl model' do
31
+ context 'when describing a non factory_bot model' do
32
32
 
33
33
  it "should return a strategy for the class matching a natural language expression" do
34
34
  subject.from_prose("movie", nil).model_class.should == Movie
@@ -29,27 +29,27 @@ describe 'steps provided by cucumber_factory' do
29
29
  invoke_cucumber_step('there is a machinist model (Variant Mark Two) with the attribute "foo"')
30
30
  end
31
31
 
32
- it "should create models that have a factory_girl factory by calling #FactoryGirl.create(:model_name)" do
33
- FactoryGirl.stub_factories :job_offer => JobOffer
34
- FactoryGirl.should_receive(:create).with(:job_offer, { :title => "Awesome job" })
32
+ it "should create models that have a factory_bot factory by calling #FactoryBot.create(:model_name)" do
33
+ FactoryBot.stub_factories :job_offer => JobOffer
34
+ FactoryBot.should_receive(:create).with(:job_offer, { :title => "Awesome job" })
35
35
  invoke_cucumber_step('there is a job offer with the title "Awesome job"')
36
36
  end
37
37
 
38
- it "should create model variants that have a factory_girl factory by calling #FactoryGirl.create(:variant)" do
39
- FactoryGirl.stub_factories :tempting_job_offer => JobOffer
40
- FactoryGirl.should_receive(:create).with(:tempting_job_offer, { :title => "Awesomafiablyfantasmic job" })
38
+ it "should create model variants that have a factory_bot factory by calling #FactoryBot.create(:variant)" do
39
+ FactoryBot.stub_factories :tempting_job_offer => JobOffer
40
+ FactoryBot.should_receive(:create).with(:tempting_job_offer, { :title => "Awesomafiablyfantasmic job" })
41
41
  invoke_cucumber_step('there is a job offer (tempting job offer) with the title "Awesomafiablyfantasmic job"')
42
42
  end
43
43
 
44
- it "should create model variants that have a factory_girl trait by calling #FactoryGirl.create(:factory, :trait1, :trait2)" do
45
- FactoryGirl.stub_factories :tempting_job_offer => JobOffer
46
- FactoryGirl.should_receive(:create).with(:tempting_job_offer, :risky, :lucrative, { :title => "Awesomafiablyfantasmic job" })
44
+ it "should create model variants that have a factory_bot trait by calling #FactoryBot.create(:factory, :trait1, :trait2)" do
45
+ FactoryBot.stub_factories :tempting_job_offer => JobOffer
46
+ FactoryBot.should_receive(:create).with(:tempting_job_offer, :risky, :lucrative, { :title => "Awesomafiablyfantasmic job" })
47
47
  invoke_cucumber_step('there is a tempting job offer (risky, lucrative) with the title "Awesomafiablyfantasmic job"')
48
48
  end
49
49
 
50
- it "should create model variants that have a factory_girl factory by using the model name as a factory name" do
51
- FactoryGirl.stub_factories :tempting_job_offer => JobOffer
52
- FactoryGirl.should_receive(:create).with(:tempting_job_offer, { :title => "Awesomafiablyfantasmic job" })
50
+ it "should create model variants that have a factory_bot factory by using the model name as a factory name" do
51
+ FactoryBot.stub_factories :tempting_job_offer => JobOffer
52
+ FactoryBot.should_receive(:create).with(:tempting_job_offer, { :title => "Awesomafiablyfantasmic job" })
53
53
  invoke_cucumber_step('there is a tempting job offer with the title "Awesomafiablyfantasmic job"')
54
54
  end
55
55
 
@@ -1,4 +1,4 @@
1
- class FactoryGirl # for factory_girl compatibility spec
1
+ class FactoryBot # for factory_bot compatibility spec
2
2
 
3
3
  def self.factories
4
4
  {}
@@ -11,7 +11,7 @@ class FactoryGirl # for factory_girl compatibility spec
11
11
  hash.each do |name, build_class|
12
12
  factories[name] = Factory.new(name, build_class)
13
13
  end
14
- FactoryGirl.stub :factories => factories
14
+ FactoryBot.stub :factories => factories
15
15
  end
16
16
  end
17
17
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.7
4
+ version: 1.11.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-22 00:00:00.000000000 Z
11
+ date: 2017-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -101,8 +101,7 @@ files:
101
101
  - spec/support/database.rb
102
102
  - spec/support/database.sample.yml
103
103
  - spec/support/database.travis.yml
104
- - spec/support/database.yml
105
- - spec/support/factory_girl_mock.rb
104
+ - spec/support/factory_bot_mock.rb
106
105
  - spec/support/models/job_offer.rb
107
106
  - spec/support/models/machinist_model.rb
108
107
  - spec/support/models/movie.rb
@@ -1,5 +0,0 @@
1
- mysql:
2
- database: cucumber_factory_test
3
- host: localhost
4
- username: root
5
- password: junior