cucumber_factory 2.0.1 → 2.3.0
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +0 -11
- data/CHANGELOG.md +51 -0
- data/Gemfile.cucumber-1.3 +9 -6
- data/Gemfile.cucumber-1.3.lock +57 -19
- data/Gemfile.cucumber-2.4 +4 -0
- data/Gemfile.cucumber-2.4.lock +12 -1
- data/Gemfile.cucumber-3.0 +4 -0
- data/Gemfile.cucumber-3.0.lock +12 -1
- data/Gemfile.cucumber-3.1 +4 -0
- data/Gemfile.cucumber-3.1.lock +12 -1
- data/README.md +32 -1
- data/lib/cucumber_factory.rb +1 -0
- data/lib/cucumber_factory/build_strategy.rb +99 -48
- data/lib/cucumber_factory/factory.rb +107 -35
- data/lib/cucumber_factory/update_strategy.rb +30 -0
- data/lib/cucumber_factory/version.rb +1 -1
- data/spec/assets/file.txt +1 -0
- data/spec/assets/file2.txt +1 -0
- data/spec/assets/symlink.txt +1 -0
- data/spec/cucumber_factory/factory/build_strategy_spec.rb +12 -14
- data/spec/cucumber_factory/steps_spec.rb +572 -403
- data/spec/spec_helper.rb +6 -0
- data/spec/support/database.rb +9 -0
- data/spec/support/factories/factories.rb +46 -0
- data/spec/support/models/job_offer.rb +1 -3
- data/spec/support/models/movie.rb +1 -0
- data/spec/support/models/opera.rb +2 -3
- data/spec/support/models/payment.rb +13 -8
- data/spec/support/uploaders/attachment_uploader.rb +3 -0
- metadata +8 -3
- data/spec/support/factory_bot_mock.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 864d657afd1eb2d45bba31a210ed4025aed3756c5224d5c2a2bfb8d9b9baa469
|
4
|
+
data.tar.gz: fc74f572c8518d5cb366e92a4799f6b74b176cc516c67cd6750432380404be49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75750f57520b8a9e535d8d26094d53fbff9678a41b3ccff12a01f0610f79cc876ee2b031a95be37e831da33d80fa7b8072ae6ef4c377be233dc87f4d2edc4994
|
7
|
+
data.tar.gz: a409eaa3516d73efaf6da8d413bd426b48cd4b2aee19621982936fab6f0d79c830b8aae07b19d064b253f69445f4c26ab97700e08d14f0022ec9a54befbcd120
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
rvm:
|
2
|
-
- 1.8.7
|
3
2
|
- 2.1.10
|
4
3
|
- 2.5.3
|
5
4
|
|
@@ -13,20 +12,10 @@ dist: trusty
|
|
13
12
|
|
14
13
|
matrix:
|
15
14
|
exclude:
|
16
|
-
- gemfile: Gemfile.cucumber-3.1
|
17
|
-
rvm: 1.8.7
|
18
15
|
- gemfile: Gemfile.cucumber-3.1
|
19
16
|
rvm: 2.1.10 # cucumber 3 wants ruby >= 2.2
|
20
|
-
- gemfile: Gemfile.cucumber-3.0
|
21
|
-
rvm: 1.8.7
|
22
17
|
- gemfile: Gemfile.cucumber-3.0
|
23
18
|
rvm: 2.1.10 # cucumber 3 wants ruby >= 2.2
|
24
|
-
- gemfile: Gemfile.cucumber-2.4
|
25
|
-
rvm: 1.8.7
|
26
|
-
- gemfile: Gemfile.cucumber-1.3
|
27
|
-
rvm: 2.5.3 # doesn't work with old RSpec
|
28
|
-
- gemfile: Gemfile.cucumber-1.3
|
29
|
-
rvm: 2.1.10 # doesn't work with old RSpec
|
30
19
|
|
31
20
|
install:
|
32
21
|
# Replace default Travis CI bundler script with a version that doesn't
|
data/CHANGELOG.md
CHANGED
@@ -15,6 +15,57 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
15
15
|
|
16
16
|
-
|
17
17
|
|
18
|
+
## 2.3.0 - 2020-09-24
|
19
|
+
|
20
|
+
### Compatible changes
|
21
|
+
|
22
|
+
- Added a step to add file objects to a model:
|
23
|
+
```cucumber
|
24
|
+
Given there is a user with the avatar file:"path/to/avatar.jpg"
|
25
|
+
```
|
26
|
+
Both single and double quotes are supported.
|
27
|
+
|
28
|
+
## 2.2.0 - 2020-09-23
|
29
|
+
|
30
|
+
### Compatible changes
|
31
|
+
|
32
|
+
- A step was added that allows modifying existing records with a similar syntax to creating new records:
|
33
|
+
```cucumber
|
34
|
+
(Given "Bob" is a user)
|
35
|
+
And "Bob" has the email "foo@bar.com" and is subscribed
|
36
|
+
```
|
37
|
+
- This step will also work with doc strings or tables:
|
38
|
+
```cucumber
|
39
|
+
(Given "Bob" is a user)
|
40
|
+
And the user above has these attributes:
|
41
|
+
| name | Bob |
|
42
|
+
| email | foo@bar.com |
|
43
|
+
```
|
44
|
+
|
45
|
+
## 2.1.1 - 2020-05-20
|
46
|
+
|
47
|
+
### Compatible changes
|
48
|
+
|
49
|
+
- Cucumber 2.1.0 introduced some regressions which are being addressed with this patch:
|
50
|
+
- Fix the assignment of polymorphic associations.
|
51
|
+
- Restore the support for inherited traits within nested factories.
|
52
|
+
|
53
|
+
## 2.1.0 - 2020-03-09
|
54
|
+
|
55
|
+
### Compatible changes
|
56
|
+
|
57
|
+
- Allow associations to be set for [transient attributes](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#transient-attributes) if they are named after the model. For example, when there is a `Role` model and the`user` factory has a transient attribute `role`, the following steps are now valid:
|
58
|
+
```
|
59
|
+
Given there is a role
|
60
|
+
And there is a user with the role above
|
61
|
+
```
|
62
|
+
|
63
|
+
## 2.0.2 - 2020-03-26
|
64
|
+
|
65
|
+
### Compatible changes
|
66
|
+
|
67
|
+
- Removed development and test support for Ruby 1.8. Closes #32.
|
68
|
+
|
18
69
|
## 2.0.1 - 2020-02-27
|
19
70
|
|
20
71
|
### Compatible changes
|
data/Gemfile.cucumber-1.3
CHANGED
@@ -2,16 +2,19 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Runtime dependencies
|
4
4
|
gem 'cucumber', '~> 1.3.20'
|
5
|
-
gem 'activesupport', '~> 2.
|
6
|
-
gem 'activerecord', '~> 2.
|
7
|
-
gem 'mysql2'
|
8
|
-
gem 'i18n', '=0.6.11' # 0.7 no longer builds for Ruby 1.8.7
|
5
|
+
gem 'activesupport', '~> 4.2.0'
|
6
|
+
gem 'activerecord', '~> 4.2.0'
|
7
|
+
gem 'mysql2'
|
9
8
|
|
10
9
|
# Development dependencies
|
11
|
-
gem 'rspec', '
|
12
|
-
gem 'rake', '
|
10
|
+
gem 'rspec', '> 3.0'
|
11
|
+
gem 'rake', '>=10.0.4'
|
13
12
|
gem 'database_cleaner', '~>1.0.0'
|
14
13
|
gem 'gemika'
|
15
14
|
|
15
|
+
# Test dependencies
|
16
|
+
gem 'factory_bot', '< 5'
|
17
|
+
gem 'carrierwave', '~> 1.0'
|
18
|
+
|
16
19
|
# Gem under test
|
17
20
|
gem 'cucumber_factory', :path => '.'
|
data/Gemfile.cucumber-1.3.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cucumber_factory (
|
4
|
+
cucumber_factory (2.3.0)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
cucumber
|
@@ -10,10 +10,25 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
|
14
|
-
activesupport (= 2.
|
15
|
-
|
16
|
-
|
13
|
+
activemodel (4.2.11.1)
|
14
|
+
activesupport (= 4.2.11.1)
|
15
|
+
builder (~> 3.1)
|
16
|
+
activerecord (4.2.11.1)
|
17
|
+
activemodel (= 4.2.11.1)
|
18
|
+
activesupport (= 4.2.11.1)
|
19
|
+
arel (~> 6.0)
|
20
|
+
activesupport (4.2.11.1)
|
21
|
+
i18n (~> 0.7)
|
22
|
+
minitest (~> 5.1)
|
23
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
24
|
+
tzinfo (~> 1.1)
|
25
|
+
arel (6.0.4)
|
26
|
+
builder (3.2.4)
|
27
|
+
carrierwave (1.2.3)
|
28
|
+
activemodel (>= 4.0.0)
|
29
|
+
activesupport (>= 4.0.0)
|
30
|
+
mime-types (>= 1.16)
|
31
|
+
concurrent-ruby (1.1.6)
|
17
32
|
cucumber (1.3.20)
|
18
33
|
builder (>= 2.1.2)
|
19
34
|
diff-lcs (>= 1.1.3)
|
@@ -23,31 +38,54 @@ GEM
|
|
23
38
|
cucumber_priority (0.3.2)
|
24
39
|
cucumber
|
25
40
|
database_cleaner (1.0.1)
|
26
|
-
diff-lcs (1.
|
27
|
-
|
41
|
+
diff-lcs (1.3)
|
42
|
+
factory_bot (4.11.1)
|
43
|
+
activesupport (>= 3.0.0)
|
44
|
+
gemika (0.4.0)
|
28
45
|
gherkin (2.12.2)
|
29
46
|
multi_json (~> 1.3)
|
30
|
-
i18n (0.
|
31
|
-
|
47
|
+
i18n (0.9.5)
|
48
|
+
concurrent-ruby (~> 1.0)
|
49
|
+
mime-types (3.2.2)
|
50
|
+
mime-types-data (~> 3.2015)
|
51
|
+
mime-types-data (3.2018.0812)
|
52
|
+
minitest (5.12.0)
|
53
|
+
multi_json (1.14.1)
|
32
54
|
multi_test (0.1.2)
|
33
|
-
mysql2 (0.
|
34
|
-
rake (
|
35
|
-
rspec (
|
55
|
+
mysql2 (0.5.3)
|
56
|
+
rake (12.3.3)
|
57
|
+
rspec (3.9.0)
|
58
|
+
rspec-core (~> 3.9.0)
|
59
|
+
rspec-expectations (~> 3.9.0)
|
60
|
+
rspec-mocks (~> 3.9.0)
|
61
|
+
rspec-core (3.9.1)
|
62
|
+
rspec-support (~> 3.9.1)
|
63
|
+
rspec-expectations (3.9.0)
|
64
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
+
rspec-support (~> 3.9.0)
|
66
|
+
rspec-mocks (3.9.1)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.9.0)
|
69
|
+
rspec-support (3.9.2)
|
70
|
+
thread_safe (0.3.6)
|
71
|
+
tzinfo (1.2.6)
|
72
|
+
thread_safe (~> 0.1)
|
36
73
|
|
37
74
|
PLATFORMS
|
38
75
|
ruby
|
39
76
|
|
40
77
|
DEPENDENCIES
|
41
|
-
activerecord (~> 2.
|
42
|
-
activesupport (~> 2.
|
78
|
+
activerecord (~> 4.2.0)
|
79
|
+
activesupport (~> 4.2.0)
|
80
|
+
carrierwave (~> 1.0)
|
43
81
|
cucumber (~> 1.3.20)
|
44
82
|
cucumber_factory!
|
45
83
|
database_cleaner (~> 1.0.0)
|
84
|
+
factory_bot (< 5)
|
46
85
|
gemika
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
rspec (~> 1.0)
|
86
|
+
mysql2
|
87
|
+
rake (>= 10.0.4)
|
88
|
+
rspec (> 3.0)
|
51
89
|
|
52
90
|
BUNDLED WITH
|
53
|
-
1.17.
|
91
|
+
1.17.3
|
data/Gemfile.cucumber-2.4
CHANGED
@@ -12,5 +12,9 @@ gem 'rake'
|
|
12
12
|
gem 'database_cleaner'
|
13
13
|
gem 'gemika'
|
14
14
|
|
15
|
+
# Test dependencies
|
16
|
+
gem 'factory_bot', '< 5' # 5.0 requires Ruby >= 2.3
|
17
|
+
gem 'carrierwave', '~> 1.0' # 2.0 requires Rails >= 5 and Ruby >= 2.2
|
18
|
+
|
15
19
|
# Gem under test
|
16
20
|
gem 'cucumber_factory', :path => '.'
|
data/Gemfile.cucumber-2.4.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cucumber_factory (2.0
|
4
|
+
cucumber_factory (2.3.0)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
cucumber
|
@@ -24,6 +24,10 @@ GEM
|
|
24
24
|
tzinfo (~> 1.1)
|
25
25
|
arel (6.0.4)
|
26
26
|
builder (3.2.3)
|
27
|
+
carrierwave (1.2.3)
|
28
|
+
activemodel (>= 4.0.0)
|
29
|
+
activesupport (>= 4.0.0)
|
30
|
+
mime-types (>= 1.16)
|
27
31
|
concurrent-ruby (1.0.5)
|
28
32
|
cucumber (2.4.0)
|
29
33
|
builder (>= 2.1.2)
|
@@ -40,10 +44,15 @@ GEM
|
|
40
44
|
cucumber
|
41
45
|
database_cleaner (1.6.2)
|
42
46
|
diff-lcs (1.3)
|
47
|
+
factory_bot (4.11.1)
|
48
|
+
activesupport (>= 3.0.0)
|
43
49
|
gemika (0.3.2)
|
44
50
|
gherkin (4.1.3)
|
45
51
|
i18n (0.9.5)
|
46
52
|
concurrent-ruby (~> 1.0)
|
53
|
+
mime-types (3.2.2)
|
54
|
+
mime-types-data (~> 3.2015)
|
55
|
+
mime-types-data (3.2018.0812)
|
47
56
|
minitest (5.11.3)
|
48
57
|
multi_json (1.13.1)
|
49
58
|
multi_test (0.1.2)
|
@@ -72,9 +81,11 @@ PLATFORMS
|
|
72
81
|
DEPENDENCIES
|
73
82
|
activerecord (~> 4.2.0)
|
74
83
|
activesupport (~> 4.2.0)
|
84
|
+
carrierwave (~> 1.0)
|
75
85
|
cucumber (~> 2.4.0)
|
76
86
|
cucumber_factory!
|
77
87
|
database_cleaner
|
88
|
+
factory_bot (< 5)
|
78
89
|
gemika
|
79
90
|
mysql2
|
80
91
|
rake
|
data/Gemfile.cucumber-3.0
CHANGED
data/Gemfile.cucumber-3.0.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cucumber_factory (2.0
|
4
|
+
cucumber_factory (2.3.0)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
cucumber
|
@@ -24,6 +24,10 @@ GEM
|
|
24
24
|
arel (7.1.4)
|
25
25
|
backports (3.11.1)
|
26
26
|
builder (3.2.3)
|
27
|
+
carrierwave (1.2.3)
|
28
|
+
activemodel (>= 4.0.0)
|
29
|
+
activesupport (>= 4.0.0)
|
30
|
+
mime-types (>= 1.16)
|
27
31
|
concurrent-ruby (1.0.5)
|
28
32
|
cucumber (3.0.2)
|
29
33
|
builder (>= 2.1.2)
|
@@ -45,10 +49,15 @@ GEM
|
|
45
49
|
cucumber
|
46
50
|
database_cleaner (1.6.2)
|
47
51
|
diff-lcs (1.3)
|
52
|
+
factory_bot (5.1.1)
|
53
|
+
activesupport (>= 4.2.0)
|
48
54
|
gemika (0.3.2)
|
49
55
|
gherkin (4.1.3)
|
50
56
|
i18n (0.9.5)
|
51
57
|
concurrent-ruby (~> 1.0)
|
58
|
+
mime-types (3.2.2)
|
59
|
+
mime-types-data (~> 3.2015)
|
60
|
+
mime-types-data (3.2018.0812)
|
52
61
|
minitest (5.11.3)
|
53
62
|
multi_json (1.13.1)
|
54
63
|
multi_test (0.1.2)
|
@@ -77,9 +86,11 @@ PLATFORMS
|
|
77
86
|
DEPENDENCIES
|
78
87
|
activerecord (~> 5.0.0)
|
79
88
|
activesupport (~> 5.0.0)
|
89
|
+
carrierwave
|
80
90
|
cucumber (~> 3.0.0)
|
81
91
|
cucumber_factory!
|
82
92
|
database_cleaner
|
93
|
+
factory_bot
|
83
94
|
gemika
|
84
95
|
mysql2
|
85
96
|
rake
|
data/Gemfile.cucumber-3.1
CHANGED
data/Gemfile.cucumber-3.1.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cucumber_factory (2.0
|
4
|
+
cucumber_factory (2.3.0)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
cucumber
|
@@ -24,6 +24,10 @@ GEM
|
|
24
24
|
arel (8.0.0)
|
25
25
|
backports (3.11.1)
|
26
26
|
builder (3.2.3)
|
27
|
+
carrierwave (1.2.3)
|
28
|
+
activemodel (>= 4.0.0)
|
29
|
+
activesupport (>= 4.0.0)
|
30
|
+
mime-types (>= 1.16)
|
27
31
|
concurrent-ruby (1.0.5)
|
28
32
|
cucumber (3.1.0)
|
29
33
|
builder (>= 2.1.2)
|
@@ -45,10 +49,15 @@ GEM
|
|
45
49
|
cucumber
|
46
50
|
database_cleaner (1.6.2)
|
47
51
|
diff-lcs (1.3)
|
52
|
+
factory_bot (5.1.1)
|
53
|
+
activesupport (>= 4.2.0)
|
48
54
|
gemika (0.3.2)
|
49
55
|
gherkin (5.0.0)
|
50
56
|
i18n (0.9.5)
|
51
57
|
concurrent-ruby (~> 1.0)
|
58
|
+
mime-types (3.2.2)
|
59
|
+
mime-types-data (~> 3.2015)
|
60
|
+
mime-types-data (3.2018.0812)
|
52
61
|
minitest (5.11.3)
|
53
62
|
multi_json (1.13.1)
|
54
63
|
multi_test (0.1.2)
|
@@ -77,9 +86,11 @@ PLATFORMS
|
|
77
86
|
DEPENDENCIES
|
78
87
|
activerecord (~> 5.1.0)
|
79
88
|
activesupport (~> 5.1.0)
|
89
|
+
carrierwave
|
80
90
|
cucumber (~> 3.1.0)
|
81
91
|
cucumber_factory!
|
82
92
|
database_cleaner
|
93
|
+
factory_bot
|
83
94
|
gemika
|
84
95
|
mysql2
|
85
96
|
rake
|
data/README.md
CHANGED
@@ -24,6 +24,13 @@ Quoted strings and numbers denote attribute values:
|
|
24
24
|
Given there is a movie with the title "Sunshine" and the year 2007
|
25
25
|
```
|
26
26
|
|
27
|
+
To update an existing record, specify the record and the changes:
|
28
|
+
```
|
29
|
+
Given the movie above has the title "Sunset" and the year 2008
|
30
|
+
Given the movie "Sunrise" has the year 2009
|
31
|
+
```
|
32
|
+
A record can be specified by the `above` keyword, which uses the last created record of this class, or by any string that was used during its creation.
|
33
|
+
|
27
34
|
Setting boolean attributes
|
28
35
|
--------------------------
|
29
36
|
|
@@ -42,6 +49,13 @@ Given there is a movie which is awesome, popular and successful but not science
|
|
42
49
|
And there is a director with the income "500000" but with the account balance "-30000"
|
43
50
|
```
|
44
51
|
|
52
|
+
To update boolean attributes use the keyword `is`:
|
53
|
+
|
54
|
+
```cucumber
|
55
|
+
Given the movie above is awesome but not popular
|
56
|
+
Given the movie above has the year 1979 but is not science fiction
|
57
|
+
```
|
58
|
+
|
45
59
|
|
46
60
|
Setting many attributes with a table
|
47
61
|
------------------------------------
|
@@ -62,10 +76,18 @@ Given there is a movie with these attributes:
|
|
62
76
|
| comedy | false |
|
63
77
|
```
|
64
78
|
|
79
|
+
```cucumber
|
80
|
+
Given the movie above has these attributes:
|
81
|
+
"""
|
82
|
+
name: Sunshine
|
83
|
+
comedy: false
|
84
|
+
"""
|
85
|
+
```
|
86
|
+
|
65
87
|
Setting associations
|
66
88
|
--------------------
|
67
89
|
|
68
|
-
You can set `belongs_to` associations by referring to the last created record of as `above`:
|
90
|
+
You can set `belongs_to` and `transient` associations by referring to the last created record of as `above`:
|
69
91
|
|
70
92
|
```cucumber
|
71
93
|
Given there is a movie with the title "Before Sunrise"
|
@@ -129,7 +151,16 @@ Given there is a movie with the tags ["comedy", "drama" and "action"]
|
|
129
151
|
```
|
130
152
|
|
131
153
|
|
154
|
+
Setting file attributes
|
155
|
+
-----------------------
|
156
|
+
|
157
|
+
You can set an attribute to a file object with the following syntax:
|
158
|
+
|
159
|
+
```cucumber
|
160
|
+
Given there is a movie with the image file:'path/to/image.jpg'
|
161
|
+
```
|
132
162
|
|
163
|
+
All paths are relative to the project root, absolute paths are not supported. Please note that file attributes must follow the syntax `file:"PATH"`, both single and double quotes are allowed.
|
133
164
|
|
134
165
|
Using named factories and traits
|
135
166
|
--------------------------------
|