Sha256: e713814c3ca78a55301bd4a226cb5c6ff0a73e271e084b0f9a48bb48b7004129

Contents?: true

Size: 798 Bytes

Versions: 8

Compression:

Stored size: 798 Bytes

Contents

require 'rails_helper'

describe 'config/initializers/error_span' do

  let(:perform) { render file: '/spec/helpers/error_span_view.html.erb' }

  before do
    assign(:model, model)
    model.valid?
  end

  context 'with errors' do

    let(:model) { Tableless.new }

    it 'should render the correct error wrappers' do
      expect(perform).to have_selector('div.has-error') do |content|
        expect(content).to have_selector('input')
        expect(content).to have_selector('span.help-block')
      end
    end
  end

  context 'no errors' do

    let(:model) { Tableless.new(title: 'valid') }

    it 'should render without any errors wrappers' do
      expect(perform).to_not have_selector('div.has-error')
      expect(perform).to_not have_selector('span.help-block')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sal-engine-0.2.0 spec/helpers/error_span_spec.rb
sal-engine-0.1.0 spec/helpers/error_span_spec.rb
sal-engine-0.0.6 spec/helpers/error_span_spec.rb
sal-engine-0.0.5 spec/helpers/error_span_spec.rb
sal-engine-0.0.4 spec/helpers/error_span_spec.rb
sal-engine-0.0.3 spec/helpers/error_span_spec.rb
sal-engine-0.0.2 spec/helpers/error_span_spec.rb
sal-engine-0.0.1 spec/helpers/error_span_spec.rb