Sha256: 7d19f41e1c7876d32e16d5d07a6fef4ce12dc86522319a73bf7969298a387732

Contents?: true

Size: 1007 Bytes

Versions: 2

Compression:

Stored size: 1007 Bytes

Contents

require 'rails_helper'
require 'railsstrap/core_ext/rails/form_for_helper'
include Railsstrap::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 match %r{input.+? class="btn btn-primary"}
    end

    context 'given a context option, applies the context class' do
      let(:options) { {context: :info} }
      it { expect(form).to match %r{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

2 entries across 2 versions & 1 rubygems

Version Path
railsstrap-4.0.0.beta3 spec/rails/form/submit_helper_spec.rb
railsstrap-4.0.0.beta2 spec/rails/form/submit_helper_spec.rb