cucumber_factory 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.cucumber-1.3 +3 -0
- data/Gemfile.cucumber-1.3.lock +4 -1
- data/Gemfile.cucumber-2.4 +3 -0
- data/Gemfile.cucumber-2.4.lock +4 -1
- data/Gemfile.cucumber-3.0 +3 -0
- data/Gemfile.cucumber-3.0.lock +4 -1
- data/Gemfile.cucumber-3.1 +3 -0
- data/Gemfile.cucumber-3.1.lock +4 -1
- data/README.md +1 -1
- data/lib/cucumber_factory/build_strategy.rb +94 -48
- data/lib/cucumber_factory/factory.rb +22 -9
- data/lib/cucumber_factory/version.rb +1 -1
- data/spec/cucumber_factory/factory/build_strategy_spec.rb +12 -14
- data/spec/cucumber_factory/steps_spec.rb +417 -405
- data/spec/spec_helper.rb +3 -0
- data/spec/support/database.rb +6 -0
- data/spec/support/factories/factories.rb +32 -0
- data/spec/support/models/job_offer.rb +1 -3
- data/spec/support/models/opera.rb +2 -3
- metadata +4 -4
- data/spec/support/factory_bot_mock.rb +0 -17
data/spec/spec_helper.rb
CHANGED
@@ -2,9 +2,11 @@ $: << File.join(File.dirname(__FILE__), "/../../lib" )
|
|
2
2
|
|
3
3
|
require 'cucumber_factory'
|
4
4
|
require 'gemika'
|
5
|
+
require 'factory_bot'
|
5
6
|
|
6
7
|
ActiveRecord::Base.default_timezone = :local
|
7
8
|
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/models/*.rb"].sort.each {|f| require f}
|
8
10
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each {|f| require f}
|
9
11
|
Dir["#{File.dirname(__FILE__)}/shared_examples/**/*.rb"].sort.each {|f| require f}
|
10
12
|
|
@@ -16,4 +18,5 @@ Gemika::RSpec.configure do |config|
|
|
16
18
|
config.before(:each) do
|
17
19
|
PlainRubyClass.reset
|
18
20
|
end
|
21
|
+
config.include FactoryBot::Syntax::Methods
|
19
22
|
end
|
data/spec/support/database.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :job_offer, :class => ::JobOffer do
|
3
|
+
transient do
|
4
|
+
my_transient_attribute { nil }
|
5
|
+
end
|
6
|
+
|
7
|
+
trait :tempting_job_offer do
|
8
|
+
transient do
|
9
|
+
other_transient_attribute { nil }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
trait :risky
|
13
|
+
trait :lucrative
|
14
|
+
end
|
15
|
+
|
16
|
+
factory :user, :class => User do
|
17
|
+
transient do
|
18
|
+
movie { nil }
|
19
|
+
end
|
20
|
+
|
21
|
+
after(:build) do |user, evaluator|
|
22
|
+
if user.reviewed_movies.blank? && evaluator.movie
|
23
|
+
user.reviewed_movies << evaluator.movie
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
factory :movie, :class => Movie
|
29
|
+
factory :opera, :class => Opera
|
30
|
+
factory :payment, :class => Payment
|
31
|
+
factory :uuid_user, :class => UuidUser
|
32
|
+
end
|
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: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -105,7 +105,7 @@ files:
|
|
105
105
|
- spec/support/database.rb
|
106
106
|
- spec/support/database.sample.yml
|
107
107
|
- spec/support/database.travis.yml
|
108
|
-
- spec/support/
|
108
|
+
- spec/support/factories/factories.rb
|
109
109
|
- spec/support/models/job_offer.rb
|
110
110
|
- spec/support/models/machinist_model.rb
|
111
111
|
- spec/support/models/movie.rb
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
137
|
+
rubygems_version: 3.0.2
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Create records from Cucumber features without writing step definitions.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class FactoryBot # for factory_bot compatibility spec
|
2
|
-
|
3
|
-
def self.factories
|
4
|
-
{}
|
5
|
-
end
|
6
|
-
|
7
|
-
Factory = Struct.new(:name, :build_class)
|
8
|
-
|
9
|
-
def self.stub_factories(hash)
|
10
|
-
factories = {}
|
11
|
-
hash.each do |name, build_class|
|
12
|
-
factories[name] = Factory.new(name, build_class)
|
13
|
-
end
|
14
|
-
FactoryBot.stub :factories => factories
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|