require 'rails_helper' require 'railsstrap/core_ext/rails/form_for_helper' include Railsstrap::Rails::Helpers describe 'file_field' do let(:protect_against_forgery?) { false } let(:form) { form_for user, layout: layout, errors: errors, url: '/', &block } let(:user) { User.new } let(:errors) { {} } let(:block) { Proc.new {|f| f.file_field :name, options.merge(accept: 'text/html')} } let(:options) { {} } context 'given any layout' do let(:layout) { :whatever } context 'not given a help option, does not display a help box' do it { expect(form).not_to include 'help-block' } end context 'given a help option, displays a help box' do let(:options) { {help: 'Please upload a file'} } it { expect(form).to include 'Please upload a file' } end end describe 'given a basic layout' do let(:layout) { :basic } specify 'applies form-group to the container to the input' do expect(form).to match %r{