rspectacular 0.41.0 → 0.42.0

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
  SHA1:
3
- metadata.gz: 086646cb2d6416003e88309aa679fff45dc9005e
4
- data.tar.gz: 41754ecd6e2932d789b1e542a081fa01c4d1672a
3
+ metadata.gz: 35aa49c4aa4087e7291bac3c161b0f93e8c992a3
4
+ data.tar.gz: 6d6e3088f1db897554de12fdc3200221e0258ba9
5
5
  SHA512:
6
- metadata.gz: 46040d797e8718a246b48ea05be62c108cb5f81443c7e9db0e9787760d36c2035bfd2073535497b20baf7eaba849116d5cd6fa656b185ba8ddca9d41de5fda82
7
- data.tar.gz: 13e0b3dbd4c0671dd2e8acade05684a2780cefbfd4fa88ef19dba9bce2812a72751bbd9f2701cf618330e7f5eb758ae72ee08646bbc1ffe49d70040924ff3f35
6
+ metadata.gz: a281c6216b168585e2374e86529bcd583781fc37c3a90a262fc21feeebbd5d52cb98173c4eaad11167d0c66767df82f26988e801b9c1c9ee018d1d9eb1bfc7eb
7
+ data.tar.gz: d3b5669c5226696bf57ae9fb034c400eb975d1f8e087b3479d623e1bea8b1ad4545a6db8d9c15b19f7de0134ec601bd840f05609029954b40ca1f9eb7bf7fa89
@@ -28,7 +28,7 @@ RSpec.configure do |config|
28
28
  FactoryGirl.create(underscored_class_name.to_sym)
29
29
  end
30
30
 
31
- authentication_method = if options.is_a?(Hash) && options[:authentication_method]
31
+ inferred_auth_method = if options.is_a?(Hash) && options[:authentication_method]
32
32
  options[:authentication_method]
33
33
  else
34
34
  :"authenticate_#{underscored_class_name}!"
@@ -36,20 +36,37 @@ RSpec.configure do |config|
36
36
 
37
37
  described_class_instance = described_class.new
38
38
 
39
- if described_class_instance.respond_to?(authentication_method, true)
40
- described_class.skip_before_action authentication_method
41
- elsif described_class_instance.respond_to?(:authenticate, true)
42
- described_class.skip_before_action :authenticate
39
+ authentication_method = if described_class_instance.respond_to?(inferred_auth_method, true)
40
+ inferred_auth_method
41
+ elsif described_class_instance.respond_to?(:authenticate, true)
42
+ :authenticate
43
+ end
44
+
45
+ if options[:status] == :unauthorized
46
+ described_class.send(:define_method, authentication_method) { false }
47
+ else
48
+ described_class.send(:define_method, authentication_method) { true }
43
49
  end
44
50
 
45
- example.example_group_instance.class.let(current_class_method) { instance }
51
+ example.example_group_instance.class.let(current_class_method) do
52
+ if options[:status] == :unauthorized
53
+ nil
54
+ else
55
+ instance
56
+ end
57
+ end
46
58
 
47
59
  described_class.send(:define_method, current_class_method) do
48
- instance
60
+ if options[:status] == :unauthorized
61
+ nil
62
+ else
63
+ instance
64
+ end
49
65
  end
50
66
 
51
67
  example.run
52
68
 
53
69
  described_class.send(:remove_method, current_class_method)
70
+ described_class.send(:remove_method, authentication_method)
54
71
  end
55
72
  end
@@ -1,3 +1,3 @@
1
1
  module RSpectacular
2
- VERSION = '0.41.0'
2
+ VERSION = '0.42.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspectacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner