Sha256: 383544c239bb9f59dee27dd30d140b354bfd7858719f2ab978bbb7b650a717cb
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'rails_helper' require 'railsstrap/core_ext/rails/form_for_helper' include Railsstrap::Rails::Helpers describe 'form_for' do let(:railsstrap) { RailsView.new } let(:protect_against_forgery?) { false } attr_accessor :output_buffer let(:form) { form_for(:object, options.merge(url: '/')) {} } let(:options) { {} } specify 'wrapped in navbar, applies Bootstrap attributes of a navbar form' do railsstrap.navbar { expect(form).to include 'role="form"' } railsstrap.navbar { expect(form).to include 'class="navbar-form"' } end specify 'wrapped in nav, surrounds the form in a <li> item' do railsstrap.nav { expect(form).to match %r{^<li><form.+?</form></li>$} } end describe 'with layout: :horizontal' do let(:options) { {layout: :horizontal} } specify 'applies Bootstrap 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 Bootstrap 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 Bootstrap attributes of a basic form' do expect(form).to include 'role="form"' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
railsstrap-4.0.0.beta3 | spec/rails/form_for_helper_spec.rb |
railsstrap-4.0.0.beta2 | spec/rails/form_for_helper_spec.rb |