decent_exposure 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f21e1f9876dc8a5fb33726db86f7dd57c37f5c02d1947594e5d35378fa3c9fb
4
- data.tar.gz: f3df28184866142fdcc357c815e035c4d12181d639cd815e9d2735cc268354d8
3
+ metadata.gz: 7f14b1fe6ed0c7cfea5f043262895e4f17bbd9cdd8f019259d8d0a44fb1f9f98
4
+ data.tar.gz: b5e0989425e1f94847b6867c4a0e81bd87d07a9fcd2683c9d64412700f7fd0d9
5
5
  SHA512:
6
- metadata.gz: 340c2ad9f56e884653dc235063e43cf874a344cd01e6f8b5fb5301c993dec5a53f4328703a154c4ae1caeeffd39c5eaea5f4a79eb9976bc34f313530d1d6933a
7
- data.tar.gz: e9d9363c1a34280c7084e1662c9428577f68d0617e31436e013f0f0e782067ecb42177849f0710cd8c49f03f2e94e4e09758771faeec5f1848a9fc02cd23eff5
6
+ metadata.gz: 705363f8c4b0fe230b6a25b3e171e74f936d1d1bc34af6a10b809d8283324c2b7a249e00d5455f5c2cec28944cf3aee94f0c2487b1c45f2b99a8ba0e60e732a8
7
+ data.tar.gz: d784e10c482a0a9e35c4aa21cf51632d6d0d28c0055f1f0b302259505c8b4f2d7feac9208af402a02a799ffca444c81d89f52ed278ef380096f1e6b45b30100c
@@ -42,7 +42,7 @@ module DecentExposure
42
42
  delegate :params, to: :controller
43
43
 
44
44
  def get_request?
45
- controller.request.get?
45
+ controller.request.get? || controller.request.head?
46
46
  end
47
47
 
48
48
  def params_method_name
@@ -1,3 +1,3 @@
1
1
  module DecentExposure
2
- VERSION = "3.0.3"
2
+ VERSION = "3.0.4"
3
3
  end
@@ -190,14 +190,14 @@ RSpec.describe DecentExposure::Controller do
190
190
 
191
191
  it "uses params method on non-get request" do
192
192
  expose :thing
193
- expect(request).to receive(:get?).and_return(false)
193
+ expect(request).to receive_messages(get?: false, head?: false)
194
194
  expect(Thing).to receive(:new).with(foo: :bar).and_return(thing)
195
195
  expect(controller).to receive(:thing_params).and_return(foo: :bar)
196
196
  end
197
197
 
198
198
  it "can use custom params method name" do
199
199
  expose :thing, build_params: :custom_params_method_name
200
- expect(request).to receive(:get?).and_return(false)
200
+ expect(request).to receive_messages(get?: false, head?: false)
201
201
  expect(Thing).to receive(:new).with(foo: :bar).and_return(thing)
202
202
  expect(controller).to receive(:custom_params_method_name).and_return(foo: :bar)
203
203
  end
@@ -38,6 +38,13 @@ RSpec.describe BirdsController, type: :controller do
38
38
  get :new
39
39
  expect(controller.bird).to be_a(Bird)
40
40
  end
41
+
42
+ context "when request.method is HEAD" do
43
+ it "builds bird if id is not provided" do
44
+ head :new
45
+ expect(controller.bird).to be_a(Bird)
46
+ end
47
+ end
41
48
  end
42
49
 
43
50
  context "when bird_params is defined" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decent_exposure
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pravosud