Skip to content

Instantly share code, notes, and snippets.

@edlvj
Created August 12, 2019 17:06
Show Gist options
  • Save edlvj/98d6e0fef640f33ea7bb0540817b3311 to your computer and use it in GitHub Desktop.
Save edlvj/98d6e0fef640f33ea7bb0540817b3311 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
# Copyright (c) 2017-2019 SwiftComply
require 'rails_helper'
RSpec.describe 'Deleting an establishment pump out', type: :system do
include_context 'tenant'
let(:establishment) do
FactoryBot.create(:establishment,
tenant: tenant)
end
let!(:pump_out) { FactoryBot.create(:pump_out, establishment: establishment) }
before do
sign_in(city_user)
visit city_establishment_path(establishment)
click_button I18n.t('activerecord.models.pump_out', count: 0)
end
it 'deletes the pump out', js: true do
expect do
accept_alert { click_link I18n.t('city.establishments.pump_outs.pump_out.delete') }
expect(page).not_to have_content(pump_out.provider_name)
end.to change(PumpOut, :count).by(-1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment