diff options
author | HombreLaser <sebastian-440@live.com> | 2023-03-25 00:10:33 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-03-25 00:10:33 -0600 |
commit | 7265af094ed16c36632128bccdcf84a3796c2359 (patch) | |
tree | 6d4f49752e0256b7c5ef2fc3e7db917be67db7bf /spec/support | |
parent | 76d44f91efab14dc0eeb84e83a77a85a7bb7fd74 (diff) |
Añade specs de addresscontroller
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/address_helper.rb | 18 | ||||
-rw-r--r-- | spec/support/shared_examples/requests/put_request.rb | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/spec/support/address_helper.rb b/spec/support/address_helper.rb new file mode 100644 index 0000000..7a678d5 --- /dev/null +++ b/spec/support/address_helper.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'rails_helper' + +# Module to form relationships between addresses and users. +module AddressHelper + def relate_user_and_addresses(user, addresses) + addresses.each do |address| + address.user_accounts << user + address.save + end + end + + def relate_user_and_address(user, address) + address.user_accounts << user + address.save + end +end diff --git a/spec/support/shared_examples/requests/put_request.rb b/spec/support/shared_examples/requests/put_request.rb index a85d842..1b6c518 100644 --- a/spec/support/shared_examples/requests/put_request.rb +++ b/spec/support/shared_examples/requests/put_request.rb @@ -12,7 +12,7 @@ RSpec.shared_examples 'a PUT request' do |account: false| context 'with incorrect parameters' do it 'returns a client side error http status and an error message' do put(route, params: wrong_params, headers:) - expect(response).to have_http_status(desired_error_status) + expect(response).to have_http_status(422) expect(response.body).to include_strings(expected_error_messages) end end |