wt-rspec-grape 0.2.0 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c69d33d068a6e76b6e3940b922d31537e1b707f7dc2d5ee90ac393884a972d23
4
- data.tar.gz: b72bd50ac8c9ec14339e0e063025c7b1b89350a1529fe03a6f32ba046bad22aa
3
+ metadata.gz: d335b8193d4ac649846cc892cefa101024e3cbb12c7c3298fb298e27af479fc3
4
+ data.tar.gz: c93816828f2c1ae7501991dc4d3e69528810d7de728c63dc44f3de8a4ec44ead
5
5
  SHA512:
6
- metadata.gz: 0e9e13c2c5cceadb64a04784bcd900167ae1a1beb209b62df22a5e89e531025ffaaa6006b4659101ea9294a6453fe73227805f241a33c2a6c2f66c969683f032
7
- data.tar.gz: 16281b22be187da754c68b954677c0e378eedb9ad8dd4a76bdb0ead8240169ffc6589a3a16fe3f67b272ae784cc3d06b8db76e395037d8b322bb8e4ba4af3140
6
+ metadata.gz: 73bd17120280ce221b3000eb820fba7c4910abfb3e8b7da46c547b50be0e582c6ef51bd0ada045cd3b0023fb815a7923b9a5e9218bcf98aa64fa3e366cbc772e
7
+ data.tar.gz: e7c0d79bdc99367f2d724b917659e3fff3e15b8e2d0d7c17455622d6351a4266c636c0b703b4458d35ee1a3caa998073723904c80bfba3c572b4ed2eb36c86c7
data/README.md CHANGED
@@ -50,6 +50,24 @@ Or use a symbol:
50
50
  describe MyAPI, :api do
51
51
  ```
52
52
 
53
+ ### Root API
54
+
55
+ By default requests are sent to `described_class`. Since Grape 3.3, mounted APIs no longer inherit helpers, rescue handlers and prefixes from the API they are mounted into, so specs usually need to hit the root API instead. Configure it once in your spec helper:
56
+
57
+ ```ruby
58
+ RSpec.configure do |config|
59
+ config.grape_app = API
60
+ end
61
+ ```
62
+
63
+ Any Rack app works, e.g. `Rails.application`. It can also be overridden per example group with metadata:
64
+
65
+ ```ruby
66
+ describe MyAPI, type: :api, grape_app: OtherAPI do
67
+ ```
68
+
69
+ Defining `app` (or `let(:app)`) in an example group still takes precedence.
70
+
53
71
  ### Basic usage
54
72
 
55
73
  This gem provides the `call_api` helper method. It automatically reads endpoint url and method from context description, allowing you to avoid duplication and write a shorter spec:
@@ -4,7 +4,7 @@ module RSpec
4
4
  include Rack::Test::Methods
5
5
 
6
6
  def app
7
- self.described_class
7
+ self.class.metadata[:grape_app] || RSpec.configuration.grape_app || described_class
8
8
  end
9
9
 
10
10
  def api_method
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module Grape
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -8,6 +8,8 @@ require 'rspec/grape/utils'
8
8
  require 'rspec/grape/methods'
9
9
 
10
10
  RSpec.configure do |config|
11
+ config.add_setting :grape_app
12
+
11
13
  config.include RSpec::Grape::Methods, type: :api
12
14
  config.include RSpec::Grape::Methods, :api
13
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wt-rspec-grape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Tarapon