Skip to content

Commit

Permalink
RSpec/EmptyLineAfterExample-20230301233314 (#834)
Browse files Browse the repository at this point in the history
* 🚓 regenerate rubocop todo

* 🚓 RSpec/EmptyLineAfterExample

* 🚓 regenerate rubocop todo

---------

Co-authored-by: Rubocop Challenger <rubocop@payrollhero.com>
Co-authored-by: Mathieu Jobin <99191+mathieujobin@users.noreply.github.com>
  • Loading branch information
3 people committed Mar 20, 2023
1 parent d5cd745 commit 2e37a03
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1115,15 +1115,6 @@ RSpec/EmptyExampleGroup:
Exclude:
- 'spec/lib/apipie/generator/swagger/param_description/composite_spec.rb'

# Offense count: 11
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowConsecutiveOneLiners.
RSpec/EmptyLineAfterExample:
Exclude:
- 'spec/lib/apipie/apipies_controller_spec.rb'
- 'spec/lib/apipie/generator/swagger/context_spec.rb'
- 'spec/lib/swagger/swagger_dsl_spec.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterExampleGroup:
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/apipie/apipies_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,15 @@
get :index
expect(test).to eq(true)
end

it "remove all resources" do
Apipie.configuration.authorize = Proc.new do |&args|
false
end
get :index
expect(assigns(:doc)[:resources]).to eq({})
end

it "remove all methods" do
Apipie.configuration.authorize = Proc.new do |controller, method, doc|
!method
Expand All @@ -225,6 +227,7 @@
expect(assigns(:doc)[:resources]["twitter_example"][:methods]).to eq([])
expect(assigns(:doc)[:resources]["users"][:methods]).to eq([])
end

it "remove specific method" do
Apipie.configuration.authorize = nil
get :index
Expand All @@ -241,6 +244,7 @@
expect(assigns(:doc)[:resources]["users"][:methods].size).to eq(users_methods - 1)
expect(assigns(:doc)[:resources]["twitter_example"][:methods].size).to eq(twitter_example_methods)
end

it "does not allow access to swagger when authorization is set" do
get :index, :params => { :format => "json", :type => "swagger"}

Expand Down
1 change: 1 addition & 0 deletions spec/lib/apipie/generator/swagger/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

describe '#in_schema?' do
it { is_expected.to be_in_schema }

context 'when in_schema is false' do
let(:in_schema) { false }

Expand Down
6 changes: 6 additions & 0 deletions spec/lib/swagger/swagger_dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ def have_field?(field, expected_name, breadcrumb)

expect(returns_obj).to match_field_structure([:pet_name, :animal_type])
end

it 'should have the 201 response described in the swagger' do
response = swagger_response_for('/pets/{id}/extra_info', 201)
expect(response[:description]).to eq("Found a pet")
Expand All @@ -359,6 +360,7 @@ def have_field?(field, expected_name, breadcrumb)
{:pet_measurements => [:weight, :height, :num_legs]}
])
end

it 'should have the 202 response described in the swagger' do
response = swagger_response_for('/pets/{id}/extra_info', 202)
expect(response[:description]).to eq('Accepted')
Expand Down Expand Up @@ -388,6 +390,7 @@ def have_field?(field, expected_name, breadcrumb)
{:additional_histories => [:did_visit_vet, :avg_meals_per_day]}
])
end

it 'should have the 203 response described in the swagger' do
response = swagger_response_for('/pets/{id}/extra_info', 203)
expect(response[:description]).to eq('Non-Authoritative Information')
Expand Down Expand Up @@ -424,6 +427,7 @@ def have_field?(field, expected_name, breadcrumb)

expect(returns_obj).to match_field_structure([:int_array, :enum_array])
end

it 'should have the 204 response described in the swagger' do
response = swagger_response_for('/pets/{id}/extra_info', 204)

Expand All @@ -444,6 +448,7 @@ def have_field?(field, expected_name, breadcrumb)
:num_fleas
])
end

it 'should have the 422 response described in the swagger' do
response = swagger_response_for('/pets/{id}/extra_info', 422)
expect(response[:description]).to eq('Fleas were discovered on the pet')
Expand Down Expand Up @@ -568,6 +573,7 @@ def have_field?(field, expected_name, breadcrumb)
{:pet_measurements => [:weight, :height, :num_legs]}
])
end

it 'should have the 200 response described in the swagger' do
response = swagger_response_for('/pets_with_measurements_described_as_class/{id}', 200)
expect(response[:description]).to eq('measurements of the pet')
Expand Down

0 comments on commit 2e37a03

Please sign in to comment.