diff options
Diffstat (limited to 'spec/requests')
10 files changed, 21 insertions, 22 deletions
diff --git a/spec/requests/addresses_controller/create_spec.rb b/spec/requests/addresses_controller/create_spec.rb index befb80b..5987e0f 100644 --- a/spec/requests/addresses_controller/create_spec.rb +++ b/spec/requests/addresses_controller/create_spec.rb @@ -15,8 +15,7 @@ RSpec.describe 'POST /account/addresses', type: :request do it_behaves_like 'a POST request' do let(:route) { '/api/account/addresses' } let(:expected_error_messages) do - ["Number can't be blank", "Street can't be blank", "Zip code can't be blank", - 'Country is invalid', "City can't be blank"] + ["can't be blank", "can't be blank", "can't be blank", 'is invalid', "can't be blank"] end let(:desired_error_status) { 422 } let(:expected_text) { [address.number.to_s, address.zip_code.to_s, address.country, address.street, address.city] } diff --git a/spec/requests/addresses_controller/update_spec.rb b/spec/requests/addresses_controller/update_spec.rb index 0c3662e..a5b993a 100644 --- a/spec/requests/addresses_controller/update_spec.rb +++ b/spec/requests/addresses_controller/update_spec.rb @@ -21,8 +21,8 @@ RSpec.describe 'PUT /api/account/addresses', type: :request do let(:route) { "/api/account/addresses/#{address.id}" } let(:wrong_route) { "/api/account/addresses/#{SecureRandom.hex(8)}" } let(:expected_error_messages) do - ["Number can't be blank", "Street can't be blank", "Zip code can't be blank", - 'Country is invalid', "City can't be blank"] + ["can't be blank", "can't be blank", "can't be blank", + 'is invalid', "can't be blank"] end let(:expected_text) do [new_address.number.to_s, new_address.zip_code.to_s, new_address.country, new_address.street, diff --git a/spec/requests/cards_controller/create_spec.rb b/spec/requests/cards_controller/create_spec.rb index 465288b..af04a23 100644 --- a/spec/requests/cards_controller/create_spec.rb +++ b/spec/requests/cards_controller/create_spec.rb @@ -15,11 +15,11 @@ RSpec.describe 'POST /account/cards', type: :request do it_behaves_like 'a POST request' do let(:route) { '/api/account/cards' } let(:expected_error_messages) do - ['Number is the wrong length (should be 16 characters)', - 'Expiration year must be greater than 1970', - 'Expiration month is not included in the list', - 'Expiration day is not included in the list', - "Security code can't be blank"] + ['is the wrong length (should be 16 characters)', + 'must be greater than 1970', + 'is not included in the list', + 'is not included in the list', + "can't be blank"] end let(:desired_error_status) { 422 } let(:expected_text) do diff --git a/spec/requests/cards_controller/update_spec.rb b/spec/requests/cards_controller/update_spec.rb index 77b4c4f..453befc 100644 --- a/spec/requests/cards_controller/update_spec.rb +++ b/spec/requests/cards_controller/update_spec.rb @@ -17,11 +17,11 @@ RSpec.describe 'PUT /api/account/addresses', type: :request do let(:route) { "/api/account/cards/#{card.id}" } let(:wrong_route) { "/api/account/cards/#{SecureRandom.hex(8)}" } let(:expected_error_messages) do - ['Number is the wrong length (should be 16 characters)', - 'Expiration year must be greater than 1970', - 'Expiration month is not included in the list', - 'Expiration day is not included in the list', - "Security code can't be blank"] + ['is the wrong length (should be 16 characters)', + 'must be greater than 1970', + 'is not included in the list', + 'is not included in the list', + "can't be blank"] end let(:expected_text) do [new_card.number, new_card.expiration_year, new_card.expiration_month, new_card.expiration_day, diff --git a/spec/requests/companies_controller/create_spec.rb b/spec/requests/companies_controller/create_spec.rb index 219868b..74a448a 100644 --- a/spec/requests/companies_controller/create_spec.rb +++ b/spec/requests/companies_controller/create_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'POST /api/companies', type: :request do let(:headers) { { 'CONTENT_TYPE' => 'application/json', 'Authorization' => "Bearer #{token['token']}" } } let(:route) { '/api/companies' } let(:expected_error_messages) do - ["Name can't be blank", "Short name can't be blank", "Country can't be blank"] + ["can't be blank", "can't be blank", "can't be blank"] end let(:desired_error_status) { 422 } let(:expected_text) { [company.name, company.short_name, company.country, 'logo', 'http'] } diff --git a/spec/requests/companies_controller/update_spec.rb b/spec/requests/companies_controller/update_spec.rb index fd23365..de8cb2a 100644 --- a/spec/requests/companies_controller/update_spec.rb +++ b/spec/requests/companies_controller/update_spec.rb @@ -14,7 +14,7 @@ RSpec.describe 'PUT /api/companies/company_id', type: :request do let(:route) { "/api/companies/#{company.short_name}" } let(:wrong_route) { "/api/companies/#{SecureRandom.hex(8)}" } let(:expected_error_messages) do - ["Name can't be blank", "Short name can't be blank", "Country can't be blank"] + ["can't be blank", "can't be blank", "can't be blank"] end let(:expected_text) { [new_company.name, new_company.short_name, new_company.country, 'logo', 'http'] } let(:params) do diff --git a/spec/requests/products_controller/create_spec.rb b/spec/requests/products_controller/create_spec.rb index 400fd18..4d6a9bc 100644 --- a/spec/requests/products_controller/create_spec.rb +++ b/spec/requests/products_controller/create_spec.rb @@ -17,8 +17,8 @@ RSpec.describe 'POST /api/products', type: :request do let(:headers) { { 'CONTENT_TYPE' => 'application/json', 'Authorization' => "Bearer #{token['token']}" } } let(:route) { '/api/products' } let(:expected_error_messages) do - ["Name can't be blank", 'Unitary price must be greater than 0', 'Bulk price must be greater than 0', - 'Available quantity must be greater than 0', 'Company must exist'] + ["can't be blank", 'must be greater than 0', 'must be greater than 0', + 'must be greater than 0', 'must exist'] end let(:desired_error_status) { 422 } let(:expected_text) do diff --git a/spec/requests/products_controller/update_spec.rb b/spec/requests/products_controller/update_spec.rb index f916d6a..c84c5bd 100644 --- a/spec/requests/products_controller/update_spec.rb +++ b/spec/requests/products_controller/update_spec.rb @@ -19,8 +19,8 @@ RSpec.describe 'PUT /api/products/product_id', type: :request do let(:route) { "/api/products/#{product.public_id}" } let(:wrong_route) { "/api/products/#{SecureRandom.hex(8)}" } let(:expected_error_messages) do - ["Name can't be blank", 'Unitary price must be greater than 0', 'Bulk price must be greater than 0', - 'Available quantity must be greater than 0', 'Company must exist'] + ["can't be blank", 'must be greater than 0', 'must be greater than 0', + 'must be greater than 0', 'must exist'] end let(:desired_error_status) { 422 } let(:expected_text) do diff --git a/spec/requests/user_accounts_controller/create_spec.rb b/spec/requests/user_accounts_controller/create_spec.rb index a45e02b..7b70268 100644 --- a/spec/requests/user_accounts_controller/create_spec.rb +++ b/spec/requests/user_accounts_controller/create_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'POST /api/user_accounts', type: :request do let(:headers) { {} } let(:route) { '/api/user_accounts' } let(:expected_error_messages) do - ["Password can't be blank", 'Email is invalid', "First name can't be blank", "Last name can't be blank"] + ["can't be blank", 'is invalid', "can't be blank", "can't be blank"] end let(:desired_error_status) { 422 } let(:expected_text) { %w[token refresh] } diff --git a/spec/requests/user_accounts_controller/update_spec.rb b/spec/requests/user_accounts_controller/update_spec.rb index fcfb28e..e26f819 100644 --- a/spec/requests/user_accounts_controller/update_spec.rb +++ b/spec/requests/user_accounts_controller/update_spec.rb @@ -17,7 +17,7 @@ RSpec.describe 'PUT /api/account', type: :request do let(:desired_error_status) { 422 } let(:wrong_params) { { email: 'notanemail', password: '', first_name: '', last_name: '' } } let(:expected_error_messages) do - ['Email is invalid', "First name can't be blank", "Last name can't be blank"] + ['is invalid', "can't be blank", "can't be blank"] end end end |