Sha256: be35f562002ee775c48af2fe097bc57c3f1e8090657d0d2de75e8ade8f80de23

Contents?: true

Size: 783 Bytes

Versions: 104

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe AlertComponent, type: :component do
  subject do
    render_inline(alert).to_html
  end

  let(:type) { 'notice' }

  let(:toast) { true }
  let(:dismissible) { true }
  let(:content) { 'pasaron cosas' }

  let(:alert) do
    described_class.new(type:, toast:, dismissible:).with_content(content)
  end

  %w[critical alert notice warning success].each do |flash_type|
    context "cuando el type es #{flash_type}" do
      let(:type) { flash_type }

      it do
        expect(subject).to have_text 'pasaron cosas'
      end
    end
  end

  context 'cuando el type no es vĂ¡lido' do
    let(:type) { %w[info danger].sample }

    it do
      expect { subject }.to raise_error(PgEngine::Error)
    end
  end
end

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
pg_rails-7.0.8.pre.alpha.102 pg_engine/spec/components/alert_component_spec.rb
pg_rails-7.0.8.pre.alpha.101 pg_engine/spec/components/alert_component_spec.rb
pg_rails-7.0.8.pre.alpha.100 pg_engine/spec/components/alert_component_spec.rb
pg_rails-7.0.8.pre.alpha.99 pg_engine/spec/components/alert_component_spec.rb