Skip to content

Commit ad773c3

Browse files
committed
Change assertions depending on version of grape.
1 parent 4a9889b commit ad773c3

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

.rubocop_todo.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-07-25 11:34:20 UTC using RuboCop version 1.65.0.
3+
# on 2024-08-03 08:32:56 UTC using RuboCop version 1.65.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -71,7 +71,7 @@ RSpec/DescribedClass:
7171
# Offense count: 6
7272
# Configuration parameters: CountAsOne.
7373
RSpec/ExampleLength:
74-
Max: 8
74+
Max: 12
7575

7676
# Offense count: 2
7777
# Configuration parameters: AssignmentOnly.
@@ -81,7 +81,7 @@ RSpec/InstanceVariable:
8181

8282
# Offense count: 12
8383
RSpec/MultipleExpectations:
84-
Max: 4
84+
Max: 6
8585

8686
# Offense count: 2
8787
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.

spec/features/swagger_spec.rb

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,26 @@
5151
find_by_id('endpointListTogger_headers', visible: true).click
5252
first('span[class="http_method"] a', visible: true).click
5353
click_button 'Try it out!'
54-
expect(page).to have_css 'span.hljs-attr', text: 'X-Test-Header'
54+
if Gem::Version.new(Grape::VERSION) >= Gem::Version.new('2.0.0')
55+
expect(page).to have_css 'span.hljs-attr', text: 'x-test-header'
56+
else
57+
expect(page).to have_css 'span.hljs-attr', text: 'X-Test-Header'
58+
end
5559
expect(page).to have_css 'span.hljs-string', text: 'Test Value'
5660
end
5761

5862
it 'supports multiple headers' do
5963
find_by_id('endpointListTogger_headers', visible: true).click
6064
first('span[class="http_method"] a', visible: true).click
6165
click_button 'Try it out!'
62-
expect(page).to have_css 'span.hljs-attr', text: 'X-Test-Header'
66+
if Gem::Version.new(Grape::VERSION) >= Gem::Version.new('2.0.0')
67+
expect(page).to have_css 'span.hljs-attr', text: 'x-test-header'
68+
expect(page).to have_css 'span.hljs-attr', text: 'x-another-header'
69+
else
70+
expect(page).to have_css 'span.hljs-attr', text: 'X-Test-Header'
71+
expect(page).to have_css 'span.hljs-attr', text: 'X-Another-Header'
72+
end
6373
expect(page).to have_css 'span.hljs-string', text: 'Test Value'
64-
expect(page).to have_css 'span.hljs-attr', text: 'X-Another-Header'
6574
expect(page).to have_css 'span.hljs-string', text: 'Another Value'
6675
end
6776
end
@@ -108,7 +117,11 @@
108117
find_by_id('endpointListTogger_headers', visible: true).click
109118
first('span[class="http_method"] a', visible: true).click
110119
click_button 'Try it out!'
111-
expect(page).to have_css 'span.hljs-attr', text: 'Authorization'
120+
if Gem::Version.new(Grape::VERSION) >= Gem::Version.new('2.0.0')
121+
expect(page).to have_css 'span.hljs-attr', text: 'authorization'
122+
else
123+
expect(page).to have_css 'span.hljs-attr', text: 'Authorization'
124+
end
112125
expect(page).to have_css 'span.hljs-string', text: "Basic #{Base64.encode64('username:password').strip}"
113126
end
114127
end
@@ -127,7 +140,11 @@
127140
find_by_id('endpointListTogger_headers', visible: true).click
128141
first('span[class="http_method"] a', visible: true).click
129142
click_button 'Try it out!'
130-
expect(page).to have_css 'span.hljs-attr', text: 'Authorization'
143+
if Gem::Version.new(Grape::VERSION) >= Gem::Version.new('2.0.0')
144+
expect(page).to have_css 'span.hljs-attr', text: 'authorization'
145+
else
146+
expect(page).to have_css 'span.hljs-attr', text: 'Authorization'
147+
end
131148
expect(page).to have_css 'span.hljs-string', text: 'Bearer token'
132149
end
133150
end
@@ -146,7 +163,11 @@
146163
find_by_id('endpointListTogger_headers', visible: true).click
147164
first('span[class="http_method"] a', visible: true).click
148165
click_button 'Try it out!'
149-
expect(page).to have_css 'span.hljs-attr', text: 'Authorization'
166+
if Gem::Version.new(Grape::VERSION) >= Gem::Version.new('2.0.0')
167+
expect(page).to have_css 'span.hljs-attr', text: 'authorization'
168+
else
169+
expect(page).to have_css 'span.hljs-attr', text: 'Authorization'
170+
end
150171
expect(page).to have_css 'span.hljs-string', text: 'Token token'
151172
end
152173
end

0 commit comments

Comments
 (0)