require 'spec_helper' require 'bh/helpers/form_for_helper' include Bh::FormForHelper describe 'static_control' do let(:protect_against_forgery?) { false } let(:form) { form_for User.new, layout: layout, url: '/', &block } let(:block) { Proc.new {|f| f.static_control 'user@example.com', options } } let(:options) { {} } context 'given any layout' do let(:layout) { :whatever } specify 'adds a paragraph with the static control' do expect(form).to include '
user@example.com

' end context 'given a label option, uses the provided one' do let(:options) { {label: 'Email'} } it { expect(form).to include 'Email' } end context 'given the text as a block' do let(:block) { Proc.new {|f| f.static_control(label: 'Email') { 'user@example.com' } } } specify 'behaves in the same way' do expect(form).to include '
user@example.com

' expect(form).to include 'Email' end end end describe 'given a basic layout and a label' do let(:layout) { :basic } let(:options) { {label: 'Email'} } specify 'uses the provided label' do expect(form).to include 'Email
Email' end end end