Skip to content

Commit

Permalink
#64 - Changing logic to delete favorite place and fixing style sheet
Browse files Browse the repository at this point in the history
Co-authored-by: heronsousa <heronrsousa@hotmail.com>
  • Loading branch information
zarbielli and heronsousa committed Nov 12, 2018
1 parent 6c9601b commit fb526e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 0 additions & 2 deletions indicaAi/app/controllers/favorite_locals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def destroy
response_error('ERROR', 'Favorite not found', 404)
elsif @favorite.destroy
response_success('SUCCESS', 'Deleted favorite', @favorite, 200)
else
response_error('ERROR', 'Favorite not deleted', 422)
end
end

Expand Down
15 changes: 15 additions & 0 deletions indicaAi/spec/controllers/favorite_locals_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,22 @@
post :create, params: valid_params
expect(response).not_to be_success
end
end
end

RSpec.describe FavoriteLocalsController, type: :controller do
let!(:user_test) { create(:user_identifier) }
let!(:local_test) { create(:local) }
let!(:local_test2) { create(:local) }
let!(:valid_params) do
{
'local_id' => local_test.id,
'user_identifier' => user_test.identifier
}
end
describe 'Post error' do
it 'should return error user not found' do
# user_identifier invalid
valid_params['user_identifier'] = nil
post :create, params: valid_params
expect(response).to have_http_status(422)
Expand Down

0 comments on commit fb526e0

Please sign in to comment.