Sha256: 9e092c1dc1bc82b695a1d4d9165af0319618599153c338065d0d41a18d751757

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'bh/helpers/form_for_helper'
include Bh::FormForHelper

describe 'form_for' do
  let(:protect_against_forgery?) { false }
  attr_accessor :output_buffer
  let(:form) { form_for(:object, options.merge(url: '/')) {} }

  describe 'without a :layout option' do
    let(:options) { {} }

    specify 'does not apply Boostrap attributes to the form' do
      expect(form).not_to include 'role="form"'
    end
  end

  describe 'with layout: :horizontal' do
    let(:options) { {layout: :horizontal} }

    specify 'applies Boostrap attributes of an horizontal form' do
      expect(form).to include 'role="form"'
      expect(form).to include 'class="form-horizontal"'
    end
  end

  describe 'with layout: :inline' do
    let(:options) { {layout: :inline} }

    specify 'applies Boostrap attributes of an inline form' do
      expect(form).to include 'role="form"'
      expect(form).to include 'class="form-inline"'
    end
  end

  describe 'with any other value for :layout' do
    let(:options) { {layout: :basic} }

    specify 'applies Boostrap attributes of a basic form' do
      expect(form).to include 'role="form"'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bh-0.0.8 spec/helpers/form_for_helper_spec.rb
bh-0.0.7 spec/helpers/form_for_helper_spec.rb
bh-0.0.6 spec/helpers/form_for_helper_spec.rb
bh-0.0.5 spec/helpers/form_for_helper_spec.rb