diff options
author | HombreLaser <sebastian-440@live.com> | 2023-03-14 20:19:13 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-03-14 20:19:13 -0600 |
commit | 8c847a682109e8305ff1ac14cd493255884d8675 (patch) | |
tree | aeb269def99e61e69223d84c532187de0a20cef5 /spec/requests | |
parent | 5a367387cfec9c2a152c6aeba765ee5ba42e03af (diff) |
Añade specs faltantes de CompaniesController
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/companies_controller/index_companies_controller_spec.rb | 16 | ||||
-rw-r--r-- | spec/requests/companies_controller/show_companies_controller_spec.rb | 13 |
2 files changed, 29 insertions, 0 deletions
diff --git a/spec/requests/companies_controller/index_companies_controller_spec.rb b/spec/requests/companies_controller/index_companies_controller_spec.rb new file mode 100644 index 0000000..c8fb439 --- /dev/null +++ b/spec/requests/companies_controller/index_companies_controller_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'GET /api/companies', type: :request do + before(:each) do + create_list(:company, 12) + end + + it_behaves_like 'a GET index request' do + let(:headers) { {} } + let(:companies) { create_list(:company, 12) } + let(:route) { '/api/companies' } + let(:pagination_size) { 10 } + end +end diff --git a/spec/requests/companies_controller/show_companies_controller_spec.rb b/spec/requests/companies_controller/show_companies_controller_spec.rb new file mode 100644 index 0000000..fc5bbd0 --- /dev/null +++ b/spec/requests/companies_controller/show_companies_controller_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'GET /api/companies/:short_name', type: :request do + it_behaves_like 'a GET resource request' do + let(:headers) { {} } + let(:company) { create(:company) } + let(:route) { "/api/companies/#{company.short_name}" } + let(:invalid_route) { "/api/companies/#{Faker::Lorem.word}" } + let(:expected_text) { [company.name, company.id.to_s, company.short_name, company.country] } + end +end |