Skip to content

Commit

Permalink
Lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
simplegoose committed Feb 20, 2024
1 parent a30bb77 commit d10ec0f
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 301 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Metrics/AbcSize:
Metrics/ClassLength:
Max: 150
Metrics/BlockLength:
AllowedMethods: ['describe']
AllowedMethods: ['describe', 'path', 'create', 'post', 'get', 'put']
Max: 60

Style/Documentation:
Expand Down
234 changes: 114 additions & 120 deletions spec/requests/api/cars_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

RSpec.describe 'api/cars', type: :request do
path '/api/v1/cars' do

post 'Creates a car' do
tags 'create'
consumes 'application/json'
Expand All @@ -26,98 +25,95 @@
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string },
special_features: { type: :string }
}
}
}
}

response '201', 'car created' do
schema type: :object,
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
},
data: {
type: :object,
properties: {
id: { type: :integer },
name: { type: :string },
description: { type: :string },
car_image: { type: :string },
car_detail_attributes: {
type: :object,
properties: {
engine_type_id: { type: :string },
horsepower: { type: :string },
torque: { type: :string },
fuel_economy: { type: :string },
range: { type: :string },
seating_capacity: { type: :string },
cargo_space: { type: :string },
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string },
}
}
}
}
}
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
},
data: {
type: :object,
properties: {
id: { type: :integer },
name: { type: :string },
description: { type: :string },
car_image: { type: :string },
car_detail_attributes: {
type: :object,
properties: {
engine_type_id: { type: :string },
horsepower: { type: :string },
torque: { type: :string },
fuel_economy: { type: :string },
range: { type: :string },
seating_capacity: { type: :string },
cargo_space: { type: :string },
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string }
}
}
}
}
}
run_test!
end

end

end

path '/api/v1/cars/{id}' do

get 'Retrieves a car' do
tags 'Get'
produces 'application/json'
parameter name: :id, in: :path, type: :string

response '200', 'car found' do
schema type: :object,
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
},
data: {
type: :object,
properties: {
id: { type: :integer },
name: { type: :string },
description: { type: :string },
car_image: { type: :string },
car_detail_attributes: {
type: :object,
properties: {
engine_type_id: { type: :string },
horsepower: { type: :string },
torque: { type: :string },
fuel_economy: { type: :string },
range: { type: :string },
seating_capacity: { type: :string },
cargo_space: { type: :string },
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string },
}
}
}
}
}
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
},
data: {
type: :object,
properties: {
id: { type: :integer },
name: { type: :string },
description: { type: :string },
car_image: { type: :string },
car_detail_attributes: {
type: :object,
properties: {
engine_type_id: { type: :string },
horsepower: { type: :string },
torque: { type: :string },
fuel_economy: { type: :string },
range: { type: :string },
seating_capacity: { type: :string },
cargo_space: { type: :string },
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string }
}
}
}
}
}

let(:id) { create(:car).id }
run_test!
Expand Down Expand Up @@ -152,7 +148,7 @@
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string },
special_features: { type: :string }
}
}
}
Expand All @@ -163,40 +159,40 @@

response '200', 'car updated' do
schema type: :object,
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
},
data: {
type: :object,
properties: {
id: { type: :integer },
name: { type: :string },
description: { type: :string },
car_image: { type: :string },
car_detail_attributes: {
type: :object,
properties: {
engine_type_id: { type: :string },
horsepower: { type: :string },
torque: { type: :string },
fuel_economy: { type: :string },
range: { type: :string },
seating_capacity: { type: :string },
cargo_space: { type: :string },
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string },
}
}
}
}
}
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
},
data: {
type: :object,
properties: {
id: { type: :integer },
name: { type: :string },
description: { type: :string },
car_image: { type: :string },
car_detail_attributes: {
type: :object,
properties: {
engine_type_id: { type: :string },
horsepower: { type: :string },
torque: { type: :string },
fuel_economy: { type: :string },
range: { type: :string },
seating_capacity: { type: :string },
cargo_space: { type: :string },
infotainment_system: { type: :string },
safety_rating: { type: :string },
tech_features: { type: :string },
special_features: { type: :string }
}
}
}
}
}

run_test!
end
Expand All @@ -211,20 +207,18 @@

response '200', 'car deleted' do
schema type: :object,
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
},
}
properties: {
status: {
type: :object,
properties: {
code: { type: :integer },
message: { type: :string }
}
}
}

run_test!
end
end

end

end
end
Loading

0 comments on commit d10ec0f

Please sign in to comment.