Sha256: 9dabd55b2d245db97ab57454f2e4a47de014aebd72cf958e9b34599c3fb28b35

Contents?: true

Size: 902 Bytes

Versions: 1

Compression:

Stored size: 902 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::Core::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

1 entries across 1 versions & 1 rubygems

Version Path
dvl-core-0.0.4 spec/dvl_flashes_spec.rb