Sha256: e64b29887bb8ed7a4ce9baa9eb18f60b69542daa28128b7b0618c297b0bb210a

Contents?: true

Size: 1.56 KB

Versions: 27

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

require 'rails_helper'

describe 'Sign in' do
  include ActionView::RecordIdentifier

  shared_examples 'destroy from index' do
    subject do
      accept_confirm do
        find("##{dom_id(cosa)} span[title=\"Eliminar definitivamente\"] a").click
      end
      sleep 1
    end

    let(:user) { create :user, :developer }
    let!(:cosa) { create :cosa }

    before do
      create_list :cosa, 5
      login_as user
      visit '/a/cosas'
    end

    it do
      expect { subject }.to change { page.find_all('tbody tr').length }.from(6).to(5)
    end
  end

  shared_examples 'destroy from show' do
    subject do
      accept_confirm do
        find('.btn-toolbar span[title="Eliminar definitivamente"] a').click
      end
      sleep 1
    end

    let(:user) { create :user, :developer }
    let!(:cosa) { create :cosa }

    before do
      login_as user
      visit "/a/cosas/#{cosa.to_param}"
    end

    it 'muestra el flash' do
      subject
      expect(page).to have_current_path('/a/cosas')
      expect(page).to have_text('Se eliminĂ³ el coso')
    end
  end

  # drivers = %i[
  #   selenium_headless
  #   selenium_chrome_headless
  #   selenium_chrome_headless_notebook
  #   selenium_chrome_headless_iphone
  # ]
  drivers = %i[selenium_chrome_headless_iphone]
  drivers = [ENV['DRIVER'].to_sym] if ENV['DRIVER'].present?

  drivers.each do |driver|
    context("with driver '#{driver}'") do
      before do
        driven_by driver
      end

      it_behaves_like 'destroy from index'
      it_behaves_like 'destroy from show'
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
pg_rails-7.6.21.pre.4 pg_engine/spec/system/destroy_spec.rb
pg_rails-7.6.21.pre.3 pg_engine/spec/system/destroy_spec.rb
pg_rails-7.6.21.pre.2 pg_engine/spec/system/destroy_spec.rb
pg_rails-7.6.21.pre.1 pg_engine/spec/system/destroy_spec.rb
pg_rails-7.6.20 pg_engine/spec/system/destroy_spec.rb
pg_rails-7.6.19 pg_engine/spec/system/destroy_spec.rb
pg_rails-7.6.18 pg_engine/spec/system/destroy_spec.rb