Sha256: 191489a32aed6e6f0bdc98f9512ef7e6d0b1d88b9fd8eb283ee36ee5c1a931ba

Contents?: true

Size: 985 Bytes

Versions: 5

Compression:

Stored size: 985 Bytes

Contents

require 'rails_helper'
require 'bh/core_ext/rails/form_for_helper'
include Bh::Rails::Helpers

describe 'submit' do
  let(:protect_against_forgery?) { false }
  let(:form) { form_for User.new, layout: layout, url: '/', &block }
  let(:block) { Proc.new {|f| f.submit 'Save', options} }
  let(:options) { {} }

  context 'given any layout' do
    let(:layout) { :whatever }

    specify 'applies .btn.btn-primary to the button' do
      expect(form).to include 'input class="btn btn-primary"'
    end

    context 'given a context option, applies the context class' do
      let(:options) { {context: :info} }
      it { expect(form).to include 'input class="btn btn-info"' }
    end
  end

  describe 'given a horizontal layout' do
    let(:layout) { :horizontal }
    specify 'applies form-group to the container, col-sm-offset-3.col-sm-9 to the field container' do
      expect(form).to match %r{<div class="form-group"><div class="col-sm-offset-3 col-sm-9"><input}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bh-1.3.4 spec/rails/form/submit_helper_spec.rb
bh-1.3.3 spec/rails/form/submit_helper_spec.rb
bh-1.3.1 spec/rails/form/submit_helper_spec.rb
bh-1.3.0 spec/rails/form/submit_helper_spec.rb
bh-1.2.0 spec/rails/form/submit_helper_spec.rb