Sha256: f57e07f587b8a0e122265eaf3550a136816795b4e7192c42dba2d992b7940664

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe 'bootstrap_form_for' do
  describe 'default_form_builder' do
    it 'should be accessible' do
      BootstrapForms.should respond_to(:default_form_builder)
    end

    it 'should be the BootstrapForms form_builder by default' do
      BootstrapForms.default_form_builder.should == BootstrapForms::FormBuilder
    end

    context 'when set to something else' do
      before do
        BootstrapForms.default_form_builder = MyCustomFormBuilder
      end

      it 'should be that other thing' do
        BootstrapForms.default_form_builder.should == MyCustomFormBuilder
      end

      describe 'projects/new.html.erb', :type => :view do
        before do
          assign :project, Project.new
          render :file => 'projects/new', :layout => 'layouts/application', :handlers => [:erb]
        end

        it 'should render with the other form builder' do
          # in other words, it shouldn't be wrapped with the bootstrap stuff
          rendered.should_not match /<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name<\/label><div class=\"controls\">.*<\/div><\/div>/
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap_forms-3.0.0.rc1 spec/lib/bootstrap_forms/bootstrap_form_for_spec.rb
bootstrap_forms-2.1.1 spec/lib/bootstrap_forms/bootstrap_form_for_spec.rb