Skip to content

Commit

Permalink
Correct rubocop offences
Browse files Browse the repository at this point in the history
  • Loading branch information
tsheporamantso committed Mar 4, 2024
1 parent e88cf09 commit cb6dfaa
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 102 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ group :development do
# gem "spring"
end

gem 'rswag'
gem 'devise'
gem 'rswag'
94 changes: 47 additions & 47 deletions spec/integration/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
user_id: { type: :number },
address: { type: :string }
},
required: [ 'description', 'location', 'rate', 'user_id', 'address' ]
required: %w[description location rate user_id address]
}

response '201', 'place created' do
Expand All @@ -38,16 +38,16 @@

response '200', 'place found' do
schema type: :object,
properties: {
id: { type: :integer },
description: { type: :string },
photo: { type: :string },
location: { type: :string },
rate: { type: :number },
user_id: { type: :number },
address: { type: :string }
},
required: [ 'id', 'description', 'location', 'rate', 'user_id', 'address' ]
properties: {
id: { type: :integer },
description: { type: :string },
photo: { type: :string },
location: { type: :string },
rate: { type: :number },
user_id: { type: :number },
address: { type: :string }
},
required: %w[id description location rate user_id address]

let(:id) { Place.create(description: 'foo', location: 'bar', rate: 1, user_id: 1, address: 'baz').id }
run_test!
Expand Down Expand Up @@ -75,7 +75,7 @@
user_id: { type: :number },
address: { type: :string }
},
required: [ 'description', 'location', 'rate', 'user_id', 'address' ]
required: %w[description location rate user_id address]
}

response '200', 'place updated' do
Expand Down Expand Up @@ -117,19 +117,19 @@

response '200', 'places found' do
schema type: :array,
items: {
type: :object,
properties: {
id: { type: :integer },
description: { type: :string },
photo: { type: :string },
location: { type: :string },
rate: { type: :number },
user_id: { type: :number },
address: { type: :string }
},
required: [ 'id', 'description', 'location', 'rate', 'user_id', 'address' ]
}
items: {
type: :object,
properties: {
id: { type: :integer },
description: { type: :string },
photo: { type: :string },
location: { type: :string },
rate: { type: :number },
user_id: { type: :number },
address: { type: :string }
},
required: %w[id description location rate user_id address]
}

run_test!
end
Expand All @@ -146,17 +146,17 @@

response '200', 'reservations found' do
schema type: :array,
items: {
type: :object,
properties: {
id: { type: :integer },
start_date: { type: :string },
end_date: { type: :string },
price: { type: :number },
place_id: { type: :number }
},
required: [ 'id', 'start_date', 'end_date', 'price', 'place_id' ]
}
items: {
type: :object,
properties: {
id: { type: :integer },
start_date: { type: :string },
end_date: { type: :string },
price: { type: :number },
place_id: { type: :number }
},
required: %w[id start_date end_date price place_id]
}

run_test!
end
Expand All @@ -172,14 +172,14 @@

response '200', 'reservation found' do
schema type: :object,
properties: {
id: { type: :integer },
start_date: { type: :string },
end_date: { type: :string },
price: { type: :number },
place_id: { type: :number }
},
required: [ 'id', 'start_date', 'end_date', 'price', 'place_id' ]
properties: {
id: { type: :integer },
start_date: { type: :string },
end_date: { type: :string },
price: { type: :number },
place_id: { type: :number }
},
required: %w[id start_date end_date price place_id]

let(:id) { Reservation.create(start_date: '2021-01-01', end_date: '2021-01-02', price: 1, place_id: 1).id }
let(:user_id) { 1 }
Expand Down Expand Up @@ -207,7 +207,7 @@
price: { type: :number },
place_id: { type: :number }
},
required: [ 'start_date', 'end_date', 'price', 'place_id' ]
required: %w[start_date end_date price place_id]
}
end
end
Expand All @@ -226,7 +226,7 @@
price: { type: :number },
place_id: { type: :number }
},
required: [ 'start_date', 'end_date', 'price', 'place_id' ]
required: %w[start_date end_date price place_id]
}

response '200', 'reservation updated' do
Expand Down Expand Up @@ -265,4 +265,4 @@
end
end
end
end
end
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!

Expand Down
100 changes: 49 additions & 51 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,55 +44,53 @@
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups

# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
config.filter_run_when_matching :focus
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
config.disable_monkey_patching!
# This setting enables warnings. It's recommended, but in some cases may
# be too noisy due to issues in dependencies.
config.warnings = true
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = "doc"
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
# # This allows you to limit a spec run to individual examples or groups
# # you care about by tagging them with `:focus` metadata. When nothing
# # is tagged with `:focus`, all examples get run. RSpec also provides
# # aliases for `it`, `describe`, and `context` that include `:focus`
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
# config.filter_run_when_matching :focus
#
# # Allows RSpec to persist some state between runs in order to support
# # the `--only-failures` and `--next-failure` CLI options. We recommend
# # you configure your source control system to ignore this file.
# config.example_status_persistence_file_path = "spec/examples.txt"
#
# # Limits the available syntax to the non-monkey patched syntax that is
# # recommended. For more details, see:
# # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
# config.disable_monkey_patching!
#
# # This setting enables warnings. It's recommended, but in some cases may
# # be too noisy due to issues in dependencies.
# config.warnings = true
#
# # Many RSpec users commonly either run the entire suite or an individual
# # file, and it's useful to allow more verbose output when running an
# # individual spec file.
# if config.files_to_run.one?
# # Use the documentation formatter for detailed output,
# # unless a formatter has already been configured
# # (e.g. via a command-line flag).
# config.default_formatter = "doc"
# end
#
# # Print the 10 slowest examples and example groups at the
# # end of the spec run, to help surface which specs are running
# # particularly slow.
# config.profile_examples = 10
#
# # Run specs in random order to surface order dependencies. If you find an
# # order dependency and want to debug it, you can fix the order by providing
# # the seed, which is printed after each run.
# # --seed 1234
# config.order = :random
#
# # Seed global randomization in this process using the `--seed` CLI option.
# # Setting this allows you to use `--seed` to deterministically reproduce
# # test failures related to randomization by passing the same `--seed` value
# # as the one that triggered the failure.
# Kernel.srand config.seed
end
2 changes: 0 additions & 2 deletions spec/swagger_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.configure do |config|
Expand Down

0 comments on commit cb6dfaa

Please sign in to comment.