cucumber_factory 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +7 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -1
- data/Gemfile.cucumber-1.3.lock +1 -1
- data/Gemfile.cucumber-2.4.lock +2 -2
- data/Gemfile.cucumber-3.0.lock +1 -1
- data/Gemfile.cucumber-3.1.lock +1 -1
- data/Gemfile.cucumber-4.1.lock +1 -1
- data/Gemfile.cucumber-5.3.lock +1 -1
- data/Gemfile.lock +1 -1
- data/Gemfile.rails-7 +20 -0
- data/Gemfile.rails-7.lock +138 -0
- data/cucumber_factory.gemspec +1 -0
- data/lib/cucumber_factory/build_strategy.rb +10 -2
- data/lib/cucumber_factory/factory.rb +3 -0
- data/lib/cucumber_factory/version.rb +1 -1
- data/spec/assets/symlink.txt +1 -1
- data/spec/cucumber_factory/factory/build_strategy_spec.rb +6 -0
- data/spec/cucumber_factory/steps_spec.rb +8 -0
- data/spec/support/factories/factories.rb +4 -2
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf3824a0f6c872595184e9e5b772fd86a1620d680ad201cde8b07fb53d57541c
|
4
|
+
data.tar.gz: cfc9cf7ffa2f07b79f307f058525a4c14db4d27f40cd57b7c17768994d4e71fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbf5e11cd62c8fe595c782ba1d216ce430363eb6bd38dc8a2ce918851afd30bf01af8c6dfa95ded9a9612b9264e2479a466e3539358557340e7cede1eabc815a
|
7
|
+
data.tar.gz: c92ba2dac384b42969ef024d15afd7a368f72f80e5ec2c1f6d3bbb83dc4135a151ebe70d45c09b018fddfd5e4ae501a7cbcc01dc9d292652d95e1c066e0eb161
|
data/.github/workflows/test.yml
CHANGED
@@ -22,10 +22,6 @@ jobs:
|
|
22
22
|
fail-fast: false
|
23
23
|
matrix:
|
24
24
|
include:
|
25
|
-
- ruby: 2.2.10
|
26
|
-
gemfile: Gemfile.cucumber-1.3
|
27
|
-
- ruby: 2.2.10
|
28
|
-
gemfile: Gemfile.cucumber-2.4
|
29
25
|
- ruby: 2.5.3
|
30
26
|
gemfile: Gemfile.cucumber-1.3
|
31
27
|
- ruby: 2.5.3
|
@@ -34,12 +30,19 @@ jobs:
|
|
34
30
|
gemfile: Gemfile.cucumber-3.0
|
35
31
|
- ruby: 2.5.3
|
36
32
|
gemfile: Gemfile.cucumber-3.1
|
33
|
+
|
37
34
|
- ruby: 2.6.6
|
38
35
|
gemfile: Gemfile.cucumber-4.1
|
36
|
+
|
39
37
|
- ruby: 2.7.2
|
40
38
|
gemfile: Gemfile.cucumber-5.3
|
39
|
+
|
40
|
+
- ruby: 3.0.0
|
41
|
+
gemfile: Gemfile.cucumber-4.1
|
41
42
|
- ruby: 3.0.0
|
42
43
|
gemfile: Gemfile.cucumber-5.3
|
44
|
+
- ruby: 3.0.0
|
45
|
+
gemfile: Gemfile.rails-7
|
43
46
|
env:
|
44
47
|
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
45
48
|
steps:
|
data/CHANGELOG.md
CHANGED
@@ -15,6 +15,18 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
15
15
|
|
16
16
|
-
|
17
17
|
|
18
|
+
## 2.5.0 - 2022-09-15
|
19
|
+
|
20
|
+
### Compatible changes
|
21
|
+
|
22
|
+
- Treat transient factory_bot attributes as associations if they are named like a factory.
|
23
|
+
|
24
|
+
## 2.4.1 - 2022-03-16
|
25
|
+
|
26
|
+
### Compatible changes
|
27
|
+
|
28
|
+
- Enabled MFA for RubyGems
|
29
|
+
|
18
30
|
## 2.4.0 - 2021-03-30
|
19
31
|
|
20
32
|
### Compatible changes
|
data/Gemfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Gemfile.cucumber-2.4
|
data/Gemfile.cucumber-1.3.lock
CHANGED
data/Gemfile.cucumber-2.4.lock
CHANGED
data/Gemfile.cucumber-3.0.lock
CHANGED
data/Gemfile.cucumber-3.1.lock
CHANGED
data/Gemfile.cucumber-4.1.lock
CHANGED
data/Gemfile.cucumber-5.3.lock
CHANGED
data/Gemfile.lock
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Gemfile.cucumber-2.4.lock
|
data/Gemfile.rails-7
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Runtime dependencies
|
4
|
+
gem 'cucumber', '~> 5.3.0'
|
5
|
+
gem 'activesupport', '~> 7.0.0'
|
6
|
+
gem 'activerecord', '~> 7.0.0'
|
7
|
+
gem 'pg'
|
8
|
+
|
9
|
+
# Development dependencies
|
10
|
+
gem 'rspec', '~> 3.0'
|
11
|
+
gem 'rake'
|
12
|
+
gem 'database_cleaner'
|
13
|
+
gem 'gemika'
|
14
|
+
|
15
|
+
# Test dependencies
|
16
|
+
gem 'factory_bot'
|
17
|
+
gem 'carrierwave'
|
18
|
+
|
19
|
+
# Gem under test
|
20
|
+
gem 'cucumber_factory', :path => '.'
|
@@ -0,0 +1,138 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cucumber_factory (2.5.0)
|
5
|
+
activerecord
|
6
|
+
activesupport
|
7
|
+
cucumber
|
8
|
+
cucumber_priority (>= 0.2.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activemodel (7.0.0)
|
14
|
+
activesupport (= 7.0.0)
|
15
|
+
activerecord (7.0.0)
|
16
|
+
activemodel (= 7.0.0)
|
17
|
+
activesupport (= 7.0.0)
|
18
|
+
activesupport (7.0.0)
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
+
i18n (>= 1.6, < 2)
|
21
|
+
minitest (>= 5.1)
|
22
|
+
tzinfo (~> 2.0)
|
23
|
+
addressable (2.8.0)
|
24
|
+
public_suffix (>= 2.0.2, < 5.0)
|
25
|
+
builder (3.2.4)
|
26
|
+
carrierwave (2.2.2)
|
27
|
+
activemodel (>= 5.0.0)
|
28
|
+
activesupport (>= 5.0.0)
|
29
|
+
addressable (~> 2.6)
|
30
|
+
image_processing (~> 1.1)
|
31
|
+
marcel (~> 1.0.0)
|
32
|
+
mini_mime (>= 0.1.3)
|
33
|
+
ssrf_filter (~> 1.0)
|
34
|
+
concurrent-ruby (1.1.9)
|
35
|
+
cucumber (5.3.0)
|
36
|
+
builder (~> 3.2, >= 3.2.4)
|
37
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
38
|
+
cucumber-create-meta (~> 2.0, >= 2.0.2)
|
39
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
40
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
41
|
+
cucumber-html-formatter (~> 9.0, >= 9.0.0)
|
42
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
43
|
+
cucumber-wire (~> 4.0, >= 4.0.1)
|
44
|
+
diff-lcs (~> 1.4, >= 1.4.4)
|
45
|
+
multi_test (~> 0.1, >= 0.1.2)
|
46
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
47
|
+
cucumber-core (8.0.1)
|
48
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
49
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
50
|
+
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
51
|
+
cucumber-create-meta (2.0.4)
|
52
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
53
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
54
|
+
cucumber-cucumber-expressions (10.3.0)
|
55
|
+
cucumber-gherkin (15.0.2)
|
56
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
57
|
+
cucumber-html-formatter (9.0.0)
|
58
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
59
|
+
cucumber-messages (13.2.1)
|
60
|
+
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
61
|
+
cucumber-tag-expressions (2.0.4)
|
62
|
+
cucumber-wire (4.0.1)
|
63
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
64
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
65
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
66
|
+
cucumber_priority (0.3.2)
|
67
|
+
cucumber
|
68
|
+
database_cleaner (2.0.1)
|
69
|
+
database_cleaner-active_record (~> 2.0.0)
|
70
|
+
database_cleaner-active_record (2.0.1)
|
71
|
+
activerecord (>= 5.a)
|
72
|
+
database_cleaner-core (~> 2.0.0)
|
73
|
+
database_cleaner-core (2.0.1)
|
74
|
+
diff-lcs (1.4.4)
|
75
|
+
factory_bot (6.2.0)
|
76
|
+
activesupport (>= 5.0.0)
|
77
|
+
ffi (1.15.4)
|
78
|
+
gemika (0.6.1)
|
79
|
+
i18n (1.8.11)
|
80
|
+
concurrent-ruby (~> 1.0)
|
81
|
+
image_processing (1.12.1)
|
82
|
+
mini_magick (>= 4.9.5, < 5)
|
83
|
+
ruby-vips (>= 2.0.17, < 3)
|
84
|
+
marcel (1.0.2)
|
85
|
+
middleware (0.1.0)
|
86
|
+
mini_magick (4.11.0)
|
87
|
+
mini_mime (1.1.2)
|
88
|
+
minitest (5.15.0)
|
89
|
+
multi_test (0.1.2)
|
90
|
+
pg (1.2.3)
|
91
|
+
protobuf-cucumber (3.10.8)
|
92
|
+
activesupport (>= 3.2)
|
93
|
+
middleware
|
94
|
+
thor
|
95
|
+
thread_safe
|
96
|
+
public_suffix (4.0.6)
|
97
|
+
rake (13.0.6)
|
98
|
+
rspec (3.10.0)
|
99
|
+
rspec-core (~> 3.10.0)
|
100
|
+
rspec-expectations (~> 3.10.0)
|
101
|
+
rspec-mocks (~> 3.10.0)
|
102
|
+
rspec-core (3.10.1)
|
103
|
+
rspec-support (~> 3.10.0)
|
104
|
+
rspec-expectations (3.10.1)
|
105
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
106
|
+
rspec-support (~> 3.10.0)
|
107
|
+
rspec-mocks (3.10.2)
|
108
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
109
|
+
rspec-support (~> 3.10.0)
|
110
|
+
rspec-support (3.10.3)
|
111
|
+
ruby-vips (2.1.4)
|
112
|
+
ffi (~> 1.12)
|
113
|
+
ssrf_filter (1.0.7)
|
114
|
+
sys-uname (1.2.2)
|
115
|
+
ffi (~> 1.1)
|
116
|
+
thor (1.1.0)
|
117
|
+
thread_safe (0.3.6)
|
118
|
+
tzinfo (2.0.4)
|
119
|
+
concurrent-ruby (~> 1.0)
|
120
|
+
|
121
|
+
PLATFORMS
|
122
|
+
x86_64-linux
|
123
|
+
|
124
|
+
DEPENDENCIES
|
125
|
+
activerecord (~> 7.0.0)
|
126
|
+
activesupport (~> 7.0.0)
|
127
|
+
carrierwave
|
128
|
+
cucumber (~> 5.3.0)
|
129
|
+
cucumber_factory!
|
130
|
+
database_cleaner
|
131
|
+
factory_bot
|
132
|
+
gemika
|
133
|
+
pg
|
134
|
+
rake
|
135
|
+
rspec (~> 3.0)
|
136
|
+
|
137
|
+
BUNDLED WITH
|
138
|
+
2.3.0
|
data/cucumber_factory.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{Create records from Cucumber features without writing step definitions.}
|
12
12
|
s.description = %q{Cucumber Factory allows you to create ActiveRecord models from your Cucumber features without writing step definitions for each model.}
|
13
13
|
s.license = 'MIT'
|
14
|
+
s.metadata = { 'rubygems_mfa_required' => 'true' }
|
14
15
|
|
15
16
|
s.files = `git ls-files`.split("\n")
|
16
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -22,6 +22,12 @@ module CucumberFactory
|
|
22
22
|
[strategy, transient_attributes]
|
23
23
|
end
|
24
24
|
|
25
|
+
def class_from_factory(model_prose)
|
26
|
+
if (factory = factory_bot_factory(model_prose, []))
|
27
|
+
factory.build_class
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
25
31
|
def parse_model_class(model_prose)
|
26
32
|
underscored_model_name(model_prose).camelize.constantize
|
27
33
|
end
|
@@ -40,11 +46,13 @@ module CucumberFactory
|
|
40
46
|
def factory_bot_factory(model_prose, variants)
|
41
47
|
return unless factory_bot_class
|
42
48
|
|
49
|
+
factories = factory_bot_class.factories
|
50
|
+
|
43
51
|
factory_name = factory_name_from_prose(model_prose)
|
44
|
-
factory =
|
52
|
+
factory = factories.registered?(factory_name) && factories[factory_name]
|
45
53
|
|
46
54
|
if factory.nil? && variants.present?
|
47
|
-
factory =
|
55
|
+
factory = factories.registered?(variants[0]) && factories[variants[0]]
|
48
56
|
end
|
49
57
|
|
50
58
|
factory
|
@@ -207,6 +207,9 @@ module CucumberFactory
|
|
207
207
|
if Object.const_defined?(klass_name)
|
208
208
|
association_class = klass_name.constantize
|
209
209
|
associated = true
|
210
|
+
elsif (factory_class = CucumberFactory::BuildStrategy.class_from_factory(attribute.to_s))
|
211
|
+
association_class = factory_class
|
212
|
+
associated = true
|
210
213
|
end
|
211
214
|
else
|
212
215
|
associated = false
|
data/spec/assets/symlink.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
file.txt
|
@@ -304,6 +304,14 @@ describe 'steps provided by cucumber_factory' do
|
|
304
304
|
user.reviewed_movies.first.title.should == 'Sunshine'
|
305
305
|
end
|
306
306
|
|
307
|
+
it 'allow associations for transient attributes if they are named like a factory' do
|
308
|
+
invoke_cucumber_step('there is a movie with the title "Sunshine"')
|
309
|
+
invoke_cucumber_step('there is a user with the film "Sunshine"')
|
310
|
+
user = User.last
|
311
|
+
user.reviewed_movies.count.should == 1
|
312
|
+
user.reviewed_movies.first.title.should == 'Sunshine'
|
313
|
+
end
|
314
|
+
|
307
315
|
it "should allow to set attributes via doc string" do
|
308
316
|
user = User.new
|
309
317
|
User.stub(:new => user)
|
@@ -16,11 +16,12 @@ FactoryBot.define do
|
|
16
16
|
factory :user, :class => User do
|
17
17
|
transient do
|
18
18
|
movie { nil }
|
19
|
+
film { nil }
|
19
20
|
end
|
20
21
|
|
21
22
|
after(:build) do |user, evaluator|
|
22
|
-
if user.reviewed_movies.blank? && evaluator.movie
|
23
|
-
user.reviewed_movies << evaluator.movie
|
23
|
+
if user.reviewed_movies.blank? && (evaluator.movie || evaluator.film)
|
24
|
+
user.reviewed_movies << (evaluator.movie || evaluator.film)
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -43,4 +44,5 @@ FactoryBot.define do
|
|
43
44
|
factory :opera, :class => Opera
|
44
45
|
factory :payment, :class => Payment
|
45
46
|
factory :uuid_user, :class => UuidUser
|
47
|
+
factory :film, :class => Movie
|
46
48
|
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.
|
4
|
+
version: 2.5.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:
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -92,6 +92,8 @@ files:
|
|
92
92
|
- Gemfile.cucumber-5.3
|
93
93
|
- Gemfile.cucumber-5.3.lock
|
94
94
|
- Gemfile.lock
|
95
|
+
- Gemfile.rails-7
|
96
|
+
- Gemfile.rails-7.lock
|
95
97
|
- LICENSE
|
96
98
|
- README.md
|
97
99
|
- Rakefile
|
@@ -127,7 +129,8 @@ files:
|
|
127
129
|
homepage: http://github.com/makandra/cucumber_factory
|
128
130
|
licenses:
|
129
131
|
- MIT
|
130
|
-
metadata:
|
132
|
+
metadata:
|
133
|
+
rubygems_mfa_required: 'true'
|
131
134
|
post_install_message:
|
132
135
|
rdoc_options: []
|
133
136
|
require_paths:
|
@@ -143,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
- !ruby/object:Gem::Version
|
144
147
|
version: '0'
|
145
148
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
149
|
+
rubygems_version: 3.3.22
|
147
150
|
signing_key:
|
148
151
|
specification_version: 4
|
149
152
|
summary: Create records from Cucumber features without writing step definitions.
|