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 +4 -4
- data/lib/rspectacular/plugins/authentication.rb +24 -7
- data/lib/rspectacular/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35aa49c4aa4087e7291bac3c161b0f93e8c992a3
|
4
|
+
data.tar.gz: 6d6e3088f1db897554de12fdc3200221e0258ba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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?(
|
40
|
-
|
41
|
-
|
42
|
-
|
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)
|
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
|
-
|
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
|
data/lib/rspectacular/version.rb
CHANGED