derail_specs 0.5.0 → 0.7.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 +17 -1
- data/README.md +3 -3
- data/bin/test +11 -0
- data/example/Gemfile.lock +2 -2
- data/example/factories.rb +2 -0
- data/example/tests.sh +16 -0
- data/lib/derail_specs/boot.rb +1 -1
- data/lib/derail_specs/factory_bot.rb +7 -2
- data/lib/derail_specs/factory_bot_stub.rb +8 -0
- data/lib/derail_specs/initializer_hooks.rb +2 -4
- data/lib/derail_specs/server/app.rb +8 -0
- data/lib/derail_specs/transaction.rb +4 -1
- data/lib/derail_specs/version.rb +1 -1
- data/lib/generators/templates/config/initializers/derail_specs.rb +2 -2
- metadata +3 -3
- data/Gemfile.lock +0 -122
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fd5a97903aa7dfafbbee9e93090b14179c89a1410fb7a0c61b407c65cfe97ca
|
4
|
+
data.tar.gz: 73c5204eb2d8e7dae4a2626cb7dc7fa864e6fed3206cd4e35c469e5bd669e62d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e25de02fa958daeba752d58148f4ac70fefe08561fcb2614274f3fefe7130cec6c6795586044bf398aa23b61e91683d25de8b671f28672d6a7d599812ff82bf6
|
7
|
+
data.tar.gz: 46e9ca67c97875ed08d71c18d6e965d587524a735ffef832d309f7b1283a15f37b4e3eae3aa9eff01e7b673ea3752e3df9e5205c957cad4f8753bee4900871e9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.7.0] - 2021-10-20
|
4
|
+
|
5
|
+
- Add support to mirror FactoryBot API including traits
|
6
|
+
|
7
|
+
## [0.6.1] - 2021-09-27
|
8
|
+
|
9
|
+
- Change exit status of `rails derail_specs:run` to match config.command exit status when command is provided
|
10
|
+
- Fix template initializer Rails.env.test? typo (jasonfb, #4)
|
11
|
+
|
12
|
+
## [0.6.0] - 2021-09-23
|
13
|
+
|
14
|
+
- Add /factory-bot/create-list to map to FactoryBot.create_list
|
15
|
+
|
16
|
+
## [0.5.1] - 2021-09-23
|
17
|
+
|
18
|
+
- Fixed a bug with Ruby 2.6 and Rails >= 6 where #bind_call (Ruby 2.7) was used instead of #bind#call
|
3
19
|
|
4
20
|
## [0.5.0] - 2021-09-17
|
5
21
|
|
@@ -8,7 +24,7 @@
|
|
8
24
|
## [0.4.0] - 2021-09-16
|
9
25
|
|
10
26
|
- Add infinite server mode, which can be used by not setting a command in the config
|
11
|
-
|
27
|
+
|
12
28
|
## [0.3.0] - 2021-09-16
|
13
29
|
|
14
30
|
- Add `/factory-bot/create` route to map to FactoryBot.create
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ to include your test command:
|
|
32
32
|
|
33
33
|
```ruby
|
34
34
|
DerailSpecs.configure do |config|
|
35
|
-
config.command = './tests.sh' # <-- your test command here
|
35
|
+
config.command = './tests.sh' # <-- your test command here, or blank for infinite mode
|
36
36
|
config.host = '127.0.0.1'
|
37
37
|
config.port = 3001
|
38
38
|
end
|
@@ -97,7 +97,7 @@ curl -X POST \
|
|
97
97
|
By default, DerailSpecs doesn't run any fixtures. You can configure global fixture
|
98
98
|
loading with initializer hooks in `config/initializers/derail_specs.rb`:
|
99
99
|
|
100
|
-
```
|
100
|
+
```ruby
|
101
101
|
return unless Rails.env.test?
|
102
102
|
|
103
103
|
DerailSpecs.hooks.before_server_start do
|
@@ -121,7 +121,7 @@ end
|
|
121
121
|
|
122
122
|
## Development
|
123
123
|
|
124
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
124
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the rspec tests and `bin/test` to run all tests, including sample rails app tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
125
125
|
|
126
126
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
127
127
|
|
data/bin/test
ADDED
data/example/Gemfile.lock
CHANGED
data/example/factories.rb
CHANGED
data/example/tests.sh
CHANGED
@@ -6,3 +6,19 @@ curl -X POST \
|
|
6
6
|
-d '["test", { "name": "Test Name from Curl", "created_at": "2011-11-11 11:11:11" }]' \
|
7
7
|
-H 'Content-Type: application/json' \
|
8
8
|
127.0.0.1:3001/factory-bot/create
|
9
|
+
|
10
|
+
curl -X POST \
|
11
|
+
-d '["test", 3, { "name": "Test Name from Curl", "created_at": "2011-11-11 11:11:11" }]' \
|
12
|
+
-H 'Content-Type: application/json' \
|
13
|
+
127.0.0.1:3001/factory-bot/create-list
|
14
|
+
|
15
|
+
# With traits
|
16
|
+
curl -X POST \
|
17
|
+
-d '["test", "trait1", { "name": "Test Name from Curl", "created_at": "2011-11-11 11:11:11" }]' \
|
18
|
+
-H 'Content-Type: application/json' \
|
19
|
+
127.0.0.1:3001/factory-bot/create
|
20
|
+
|
21
|
+
curl -X POST \
|
22
|
+
-d '["test", 3, "trait1", { "name": "Test Name from Curl", "created_at": "2011-11-11 11:11:11" }]' \
|
23
|
+
-H 'Content-Type: application/json' \
|
24
|
+
127.0.0.1:3001/factory-bot/create-list
|
data/lib/derail_specs/boot.rb
CHANGED
@@ -4,8 +4,13 @@ begin
|
|
4
4
|
|
5
5
|
module DerailSpecs
|
6
6
|
class FactoryBot
|
7
|
-
def self.create(
|
8
|
-
::FactoryBot.create(
|
7
|
+
def self.create(*args)
|
8
|
+
::FactoryBot.create(*args)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.create_list(*args)
|
12
|
+
puts args.to_json
|
13
|
+
::FactoryBot.create_list(*args)
|
9
14
|
end
|
10
15
|
end
|
11
16
|
end
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module DerailSpecs
|
2
2
|
class FactoryBot
|
3
3
|
def self.create(*_)
|
4
|
+
not_installed_message
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.create_list(*_)
|
8
|
+
not_installed_message
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.not_installed_message
|
4
12
|
puts "factory_bot_rails is not installed in group :test"
|
5
13
|
puts "Please add factory_bot_rails to your Gemfile to use this feature"
|
6
14
|
end
|
@@ -15,6 +15,14 @@ module DerailSpecs
|
|
15
15
|
[202, { "Content-Type" => "application/json" }, [object.to_json]]
|
16
16
|
}
|
17
17
|
end
|
18
|
+
map "/factory-bot/create-list" do
|
19
|
+
run lambda { |env|
|
20
|
+
body = Rack::Request.new(env).body.gets
|
21
|
+
object = FactoryBot.create_list(*JSON.parse(body))
|
22
|
+
|
23
|
+
[202, { "Content-Type" => "application/json" }, [object.to_json]]
|
24
|
+
}
|
25
|
+
end
|
18
26
|
map "/" do
|
19
27
|
run Rails.application
|
20
28
|
end
|
@@ -78,7 +78,10 @@ module DerailSpecs
|
|
78
78
|
@legacy_saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
|
79
79
|
@saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
|
80
80
|
|
81
|
-
ActiveRecord::TestFixtures
|
81
|
+
ActiveRecord::TestFixtures
|
82
|
+
.instance_method(:setup_shared_connection_pool)
|
83
|
+
.bind(self)
|
84
|
+
.call
|
82
85
|
end
|
83
86
|
end
|
84
87
|
end
|
data/lib/derail_specs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: derail_specs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Piechowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puma
|
@@ -52,12 +52,12 @@ files:
|
|
52
52
|
- CHANGELOG.md
|
53
53
|
- CODE_OF_CONDUCT.md
|
54
54
|
- Gemfile
|
55
|
-
- Gemfile.lock
|
56
55
|
- LICENSE.txt
|
57
56
|
- README.md
|
58
57
|
- Rakefile
|
59
58
|
- bin/console
|
60
59
|
- bin/setup
|
60
|
+
- bin/test
|
61
61
|
- derail_specs.gemspec
|
62
62
|
- example/.gitignore
|
63
63
|
- example/.ruby-version
|
data/Gemfile.lock
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
derail_specs (0.5.0)
|
5
|
-
puma (>= 3.8.0)
|
6
|
-
railties (>= 5.2.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actionpack (6.1.4.1)
|
12
|
-
actionview (= 6.1.4.1)
|
13
|
-
activesupport (= 6.1.4.1)
|
14
|
-
rack (~> 2.0, >= 2.0.9)
|
15
|
-
rack-test (>= 0.6.3)
|
16
|
-
rails-dom-testing (~> 2.0)
|
17
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.1.4.1)
|
19
|
-
activesupport (= 6.1.4.1)
|
20
|
-
builder (~> 3.1)
|
21
|
-
erubi (~> 1.4)
|
22
|
-
rails-dom-testing (~> 2.0)
|
23
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activesupport (6.1.4.1)
|
25
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
-
i18n (>= 1.6, < 2)
|
27
|
-
minitest (>= 5.1)
|
28
|
-
tzinfo (~> 2.0)
|
29
|
-
zeitwerk (~> 2.3)
|
30
|
-
ast (2.4.2)
|
31
|
-
builder (3.2.4)
|
32
|
-
concurrent-ruby (1.1.9)
|
33
|
-
crass (1.0.6)
|
34
|
-
diff-lcs (1.4.4)
|
35
|
-
erubi (1.10.0)
|
36
|
-
generator_spec (0.9.4)
|
37
|
-
activesupport (>= 3.0.0)
|
38
|
-
railties (>= 3.0.0)
|
39
|
-
i18n (1.8.10)
|
40
|
-
concurrent-ruby (~> 1.0)
|
41
|
-
loofah (2.12.0)
|
42
|
-
crass (~> 1.0.2)
|
43
|
-
nokogiri (>= 1.5.9)
|
44
|
-
method_source (1.0.0)
|
45
|
-
minitest (5.14.4)
|
46
|
-
nio4r (2.5.8)
|
47
|
-
nokogiri (1.12.4-x86_64-linux)
|
48
|
-
racc (~> 1.4)
|
49
|
-
parallel (1.21.0)
|
50
|
-
parser (3.0.2.0)
|
51
|
-
ast (~> 2.4.1)
|
52
|
-
puma (5.4.0)
|
53
|
-
nio4r (~> 2.0)
|
54
|
-
racc (1.5.2)
|
55
|
-
rack (2.2.3)
|
56
|
-
rack-test (1.1.0)
|
57
|
-
rack (>= 1.0, < 3)
|
58
|
-
rails-dom-testing (2.0.3)
|
59
|
-
activesupport (>= 4.2.0)
|
60
|
-
nokogiri (>= 1.6)
|
61
|
-
rails-html-sanitizer (1.4.2)
|
62
|
-
loofah (~> 2.3)
|
63
|
-
railties (6.1.4.1)
|
64
|
-
actionpack (= 6.1.4.1)
|
65
|
-
activesupport (= 6.1.4.1)
|
66
|
-
method_source
|
67
|
-
rake (>= 0.13)
|
68
|
-
thor (~> 1.0)
|
69
|
-
rainbow (3.0.0)
|
70
|
-
rake (13.0.6)
|
71
|
-
regexp_parser (2.1.1)
|
72
|
-
rexml (3.2.5)
|
73
|
-
rspec (3.10.0)
|
74
|
-
rspec-core (~> 3.10.0)
|
75
|
-
rspec-expectations (~> 3.10.0)
|
76
|
-
rspec-mocks (~> 3.10.0)
|
77
|
-
rspec-core (3.10.1)
|
78
|
-
rspec-support (~> 3.10.0)
|
79
|
-
rspec-expectations (3.10.1)
|
80
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.10.0)
|
82
|
-
rspec-mocks (3.10.2)
|
83
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
-
rspec-support (~> 3.10.0)
|
85
|
-
rspec-support (3.10.2)
|
86
|
-
rubocop (1.21.0)
|
87
|
-
parallel (~> 1.10)
|
88
|
-
parser (>= 3.0.0.0)
|
89
|
-
rainbow (>= 2.2.2, < 4.0)
|
90
|
-
regexp_parser (>= 1.8, < 3.0)
|
91
|
-
rexml
|
92
|
-
rubocop-ast (>= 1.9.1, < 2.0)
|
93
|
-
ruby-progressbar (~> 1.7)
|
94
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
95
|
-
rubocop-ast (1.11.0)
|
96
|
-
parser (>= 3.0.1.1)
|
97
|
-
rubocop-rake (0.6.0)
|
98
|
-
rubocop (~> 1.0)
|
99
|
-
rubocop-rspec (2.4.0)
|
100
|
-
rubocop (~> 1.0)
|
101
|
-
rubocop-ast (>= 1.1.0)
|
102
|
-
ruby-progressbar (1.11.0)
|
103
|
-
thor (1.1.0)
|
104
|
-
tzinfo (2.0.4)
|
105
|
-
concurrent-ruby (~> 1.0)
|
106
|
-
unicode-display_width (2.0.0)
|
107
|
-
zeitwerk (2.4.2)
|
108
|
-
|
109
|
-
PLATFORMS
|
110
|
-
x86_64-linux
|
111
|
-
|
112
|
-
DEPENDENCIES
|
113
|
-
derail_specs!
|
114
|
-
generator_spec
|
115
|
-
rake (~> 13.0)
|
116
|
-
rspec (~> 3.0)
|
117
|
-
rubocop (~> 1.7)
|
118
|
-
rubocop-rake
|
119
|
-
rubocop-rspec
|
120
|
-
|
121
|
-
BUNDLED WITH
|
122
|
-
2.2.27
|