Sha256: e604082f49155962b91bf41f2dadb67b3adc1cb1a29522f4a1aca29ab7596d6d

Contents?: true

Size: 896 Bytes

Versions: 9

Compression:

Stored size: 896 Bytes

Contents

require 'spec_helper'

describe 'Flashes' do
  describe 'Integration', type: :feature, js: true do
    it 'Flashes properly' do
      visit '/'
      page.execute_script "DvlFlash('error', 'Yeah!')"
      expect(page).to have_selector '.flash.flash_error', text: 'Yeah!'
      sleep 4
      expect(page).to_not have_selector '.flash.flash_error', text: 'Yeah!'
    end
  end

  describe Dvl::Components::Flashes do
    let!(:success_html) do
      described_class.new(
        flash: { 'success' => 'Yeah!' }
      ).to_html
    end

    let!(:error_html) do
      described_class.new(
        flash: { 'error' => 'No!' }
      ).to_html
    end

    it 'renders the proper html' do
      expect(success_html).to have_tag('div.flash_success', content: 'Yeah!')
    end

    it 'renders the proper html' do
      expect(error_html).to have_tag('div.flash_error', content: 'No!')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dvl-core-0.1.0 spec/dvl_flashes_spec.rb
dvl-core-0.0.12 spec/dvl_flashes_spec.rb
dvl-core-0.0.11 spec/dvl_flashes_spec.rb
dvl-core-0.0.10 spec/dvl_flashes_spec.rb
dvl-core-0.0.9 spec/dvl_flashes_spec.rb
dvl-core-0.0.8 spec/dvl_flashes_spec.rb
dvl-core-0.0.7 spec/dvl_flashes_spec.rb
dvl-core-0.0.6 spec/dvl_flashes_spec.rb
dvl-core-0.0.5 spec/dvl_flashes_spec.rb