derail_specs 0.5.1 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cf9a4363bbaa67b3fce2b01191b7bb8f7a11bdea4b1d710702e47b303cc379f
4
- data.tar.gz: 94cad7e3e96d35edb0c67dc153f366f0252e1aa5e8dec31cc182d77b3757b969
3
+ metadata.gz: f41316c2b4b33b60d06fb9a0a0b8fc647f93455e3a1a8978fd16f27b7c118b37
4
+ data.tar.gz: 4c3d831d2f467eb42fac527d07ff5edcb943b8ed36fc358ff239d5045acd3f6c
5
5
  SHA512:
6
- metadata.gz: 5da35b8957275ab2eb84d7985e941b3800e6cd08af6090b98db477237f9d2d1e350083178abefe297e94accbdadb6b1dac8d15f28f58daab26812bf5398df70d
7
- data.tar.gz: 015ef7e97de920756eeb547391f11204ca3011d5a6842d20b0ecc63c9b39cd1ea71cca72c5d3b851098e31208e29de6295412d547bad513b95ab08b62b1e46b4
6
+ metadata.gz: b92ec87ddeabfc801dfaae6dab6f064ddf9b98dd4677bcef61041da677534944fcefc038f676f7b2f99dfec8e5c62b29ada587bd5c9aba366cad89994dbb32d9
7
+ data.tar.gz: e304ee8306d696348c44427febd0090912942cc4c07fc5334e1cea6d5aaf5521b8f72db997aa55fb6cdfbb5c991e71a7eddec9bbe251dfbf2a52f12ad596b836
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2021-09-23
4
+
5
+ - Add /factory-bot/create-list to map to FactoryBot.create_list
6
+
3
7
  ## [0.5.1] - 2021-09-23
4
8
 
5
9
  - Fixed a bug with Ruby 2.6 and Rails >= 6 where #bind_call (Ruby 2.7) was used instead of #bind#call
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- derail_specs (0.5.1)
4
+ derail_specs (0.6.0)
5
5
  puma (>= 3.8.0)
6
6
  railties (>= 5.2.0)
7
7
 
data/example/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- derail_specs (0.5.1)
4
+ derail_specs (0.6.0)
5
5
  puma (>= 3.8.0)
6
6
  railties (>= 5.2.0)
7
7
 
data/example/tests.sh CHANGED
@@ -6,3 +6,8 @@ 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
@@ -7,6 +7,10 @@ begin
7
7
  def self.create(factory, options = nil)
8
8
  ::FactoryBot.create(factory, options)
9
9
  end
10
+
11
+ def self.create_list(factory, count, options = nil)
12
+ ::FactoryBot.create_list(factory, count, options)
13
+ end
10
14
  end
11
15
  end
12
16
  rescue Gem::LoadError
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DerailSpecs
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: derail_specs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Piechowski