require 'rails_helper' require 'railsstrap/core_ext/rails/form_for_helper' include Railsstrap::Rails::Helpers describe 'legend' do let(:protect_against_forgery?) { false } let(:form) { form_for User.new, layout: layout, url: '/', &block } let(:block) { Proc.new {|f| f.legend 'Basic info' } } let(:layout) { :whatever } specify 'adds a to the form' do expect(form).to include 'legend' end describe 'given a basic layout' do let(:layout) { :basic } specify 'applies form-group to the container' do expect(form).to match %r{
Basic info
} end end describe 'given a horizontal layout' do let(:layout) { :horizontal } specify 'applies form-group to the container, col-sm-12 to the field container' do expect(form).to match %r{
Basic info
} end end describe 'given an inline layout' do let(:layout) { :inline } specify 'applies sr-only to the legend' do expect(form).to match %r{Basic info} end end end