factory_girl_rspec 2.1.0 → 3.0.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/.ruby-version +1 -1
- data/.travis.yml +3 -0
- data/README.md +9 -7
- data/factory_girl_rspec.gemspec +6 -6
- data/lib/{factory_girl → factory_bot}/rspec/dsl.rb +5 -5
- data/lib/factory_bot/rspec/version.rb +5 -0
- data/lib/factory_girl_rspec.rb +3 -3
- data/spec/factories/users.rb +1 -1
- data/spec/factory_girl_rspec_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -2
- metadata +24 -23
- data/lib/factory_girl/rspec/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40424ea7e7ad37831da0a0f2237059bd518bc3f4
|
4
|
+
data.tar.gz: 75ea5d9def6b7b56c8ce47f8dbc76616e4cb76af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88985e545788807e830942ba94295ed6abf59ef5f4a8759e5a636ae3a2ddc96b950cb0c97deb8c7f3c770d1ad90e3861d98e37d7fc79adc2f508832f1c78a2fe
|
7
|
+
data.tar.gz: 143e5561bdd6cd289de670bd04e3fc9141de9b87abbc67a0c12a5e8be938c7e3324a14bd851926a6275e753dca6241d076b916ac0d03510674ad728ab9e40a3e
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.4.2
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# factory_girl_rspec
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/wireframe/factory_girl_rspec)
|
4
|
+
|
5
|
+
Integrate FactoryBot fixture initialization into the RSpec DSL.
|
4
6
|
|
5
7
|
## Features
|
6
|
-
* clean and concise DSL for instantiating
|
7
|
-
* easily configure factory variations with
|
8
|
-
* [includes
|
8
|
+
* clean and concise DSL for instantiating FactoryBot fixtures
|
9
|
+
* easily configure factory variations with FactoryBot traits or optional parameter hash
|
10
|
+
* [includes FactoryBot DSL into main Rspec context to DRY up creation](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#using-factories)
|
9
11
|
|
10
12
|
## Usage
|
11
13
|
|
@@ -15,7 +17,7 @@ Basic usage:
|
|
15
17
|
# spec/models/user_spec.rb
|
16
18
|
describe User do
|
17
19
|
context 'basic user' do
|
18
|
-
# instantiate
|
20
|
+
# instantiate FactoryBot :user fixture
|
19
21
|
with :user
|
20
22
|
it { user.should be_inactive }
|
21
23
|
it { user.should_not be_happy }
|
@@ -29,14 +31,14 @@ Advanced usage:
|
|
29
31
|
# spec/models/user_spec.rb
|
30
32
|
describe User do
|
31
33
|
context 'when user.first_name == nil' do
|
32
|
-
# instantiate
|
34
|
+
# instantiate FactoryBot :user fixture with custom options
|
33
35
|
with :user, :first_name => nil
|
34
36
|
it { user.should be_inactive }
|
35
37
|
it { user.should_not be_happy }
|
36
38
|
end
|
37
39
|
|
38
40
|
context 'when user is inactive' do
|
39
|
-
# instantiate
|
41
|
+
# instantiate FactoryBot :user fixture with custom traits
|
40
42
|
with :user, :when_inactive
|
41
43
|
it { user_when_inactive.should be_inactive }
|
42
44
|
end
|
data/factory_girl_rspec.gemspec
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "
|
3
|
+
require "factory_bot/rspec/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "factory_girl_rspec"
|
7
|
-
s.version =
|
7
|
+
s.version = FactoryBot::Rspec::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Ryan Sonnek"]
|
10
10
|
s.email = ["ryan@codecrate.com"]
|
11
11
|
s.homepage = ""
|
12
|
-
s.summary = %q{integrate
|
13
|
-
s.description = %q{add helper methods to quickly instantiate and assign factory
|
12
|
+
s.summary = %q{integrate factory_bot directly into the RSpec DSL}
|
13
|
+
s.description = %q{add helper methods to quickly instantiate and assign factory bot fixtures to your test context}
|
14
14
|
|
15
15
|
s.rubyforge_project = "factory_girl_rspec"
|
16
16
|
|
17
17
|
s.add_runtime_dependency 'rspec', '>= 2.0'
|
18
|
-
s.add_runtime_dependency '
|
18
|
+
s.add_runtime_dependency 'factory_bot', '>= 4.8'
|
19
19
|
|
20
|
-
s.add_development_dependency '
|
20
|
+
s.add_development_dependency 'rake'
|
21
21
|
|
22
22
|
s.files = `git ls-files`.split("\n")
|
23
23
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require '
|
1
|
+
require 'factory_bot'
|
2
2
|
|
3
|
-
module
|
3
|
+
module FactoryBot
|
4
4
|
module Rspec
|
5
5
|
module Dsl
|
6
6
|
# define an rspec helper method that lazily creates the referenced
|
7
|
-
#
|
7
|
+
# FactoryBot fixture (via let)
|
8
8
|
# example usage:
|
9
9
|
# with :user
|
10
10
|
def with(*args)
|
@@ -12,7 +12,7 @@ module FactoryGirl
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# define an rspec helper method that eagerly creates the referenced
|
15
|
-
#
|
15
|
+
# FactoryBot fixture (via let!)
|
16
16
|
# example usage:
|
17
17
|
# with! :user
|
18
18
|
def with!(*args)
|
@@ -24,7 +24,7 @@ module FactoryGirl
|
|
24
24
|
def register_factory(method_name, *args)
|
25
25
|
variable_name = args.reject {|arg| arg.is_a?(Hash) }.join('_')
|
26
26
|
send(method_name, variable_name) do
|
27
|
-
::
|
27
|
+
::FactoryBot.create *args
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/factory_girl_rspec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'factory_bot/rspec/dsl'
|
2
2
|
require 'rspec'
|
3
3
|
|
4
4
|
RSpec.configure do |config|
|
5
|
-
config.extend
|
6
|
-
config.include
|
5
|
+
config.extend FactoryBot::Rspec::Dsl
|
6
|
+
config.include FactoryBot::Syntax::Methods
|
7
7
|
end
|
data/spec/factories/users.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe FactoryBot::Rspec do
|
4
4
|
describe '.with' do
|
5
5
|
context 'with factory' do
|
6
6
|
with :user
|
@@ -45,15 +45,15 @@ describe FactoryGirl::Rspec do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
48
|
+
describe FactoryBot::Syntax::Methods do
|
49
49
|
context 'create' do
|
50
|
-
it 'is available without
|
50
|
+
it 'is available without FactoryBot prefix' do
|
51
51
|
user = create :user
|
52
52
|
expect(user).to_not be_nil
|
53
53
|
end
|
54
54
|
end
|
55
55
|
context 'build' do
|
56
|
-
it 'is available without
|
56
|
+
it 'is available without FactoryBot prefix' do
|
57
57
|
user = build :user
|
58
58
|
expect(user).to_not be_nil
|
59
59
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'factory_girl_rspec'
|
2
2
|
require 'models/user'
|
3
3
|
|
4
|
-
|
4
|
+
FactoryBot.find_definitions
|
5
5
|
|
6
6
|
RSpec.configure do |config|
|
7
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
8
7
|
config.run_all_when_everything_filtered = true
|
9
8
|
config.filter_run :focus
|
10
9
|
|
metadata
CHANGED
@@ -1,58 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_girl_rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Sonnek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: factory_bot
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: add helper methods to quickly instantiate and assign factory
|
55
|
+
description: add helper methods to quickly instantiate and assign factory bot fixtures
|
56
56
|
to your test context
|
57
57
|
email:
|
58
58
|
- ryan@codecrate.com
|
@@ -60,18 +60,19 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- .gitignore
|
64
|
-
- .rspec
|
65
|
-
- .ruby-gemset
|
66
|
-
- .ruby-version
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".ruby-gemset"
|
66
|
+
- ".ruby-version"
|
67
|
+
- ".travis.yml"
|
67
68
|
- CONTRIBUTORS.txt
|
68
69
|
- Gemfile
|
69
70
|
- LICENSE.txt
|
70
71
|
- README.md
|
71
72
|
- Rakefile
|
72
73
|
- factory_girl_rspec.gemspec
|
73
|
-
- lib/
|
74
|
-
- lib/
|
74
|
+
- lib/factory_bot/rspec/dsl.rb
|
75
|
+
- lib/factory_bot/rspec/version.rb
|
75
76
|
- lib/factory_girl_rspec.rb
|
76
77
|
- spec/factories/users.rb
|
77
78
|
- spec/factory_girl_rspec_spec.rb
|
@@ -86,20 +87,20 @@ require_paths:
|
|
86
87
|
- lib
|
87
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
89
|
requirements:
|
89
|
-
- -
|
90
|
+
- - ">="
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '0'
|
92
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
|
-
- -
|
95
|
+
- - ">="
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: '0'
|
97
98
|
requirements: []
|
98
99
|
rubyforge_project: factory_girl_rspec
|
99
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.6.14
|
100
101
|
signing_key:
|
101
102
|
specification_version: 4
|
102
|
-
summary: integrate
|
103
|
+
summary: integrate factory_bot directly into the RSpec DSL
|
103
104
|
test_files:
|
104
105
|
- spec/factories/users.rb
|
105
106
|
- spec/factory_girl_rspec_spec.rb
|