Sha256: 6f6aa839a7a2340940ecb5f71ced7be2dfe95c973c2cc728335320aaf78351c0

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8
require 'spec_helper'

RSpec.describe 'InputAction', 'when submitting' do

  include FormtasticSpecHelper

  before do
    @output_buffer = ''
    mock_everything
    
    concat(semantic_form_for(@new_post) do |builder|
      concat(builder.action(:submit, :as => :input))
    end)
  end
  
  it 'should render a submit type of input' do
    expect(output_buffer).to have_tag('li.action.input_action input[@type="submit"]')
  end

end

RSpec.describe 'InputAction', 'when resetting' do

  include FormtasticSpecHelper
  
  before do
    @output_buffer = ''
    mock_everything
    
    concat(semantic_form_for(@new_post) do |builder|
      concat(builder.action(:reset, :as => :input))
    end)
  end
  
  it 'should render a reset type of input' do
    expect(output_buffer).to have_tag('li.action.input_action input[@type="reset"]')
  end
  
end

RSpec.describe 'InputAction', 'when cancelling' do

  include FormtasticSpecHelper
  
  before do
    @output_buffer = ''
    mock_everything
  end
  
  it 'should raise an error' do
    expect { 
      concat(semantic_form_for(@new_post) do |builder|
        concat(builder.action(:cancel, :as => :input))
      end)
    }.to raise_error(Formtastic::UnsupportedMethodForAction)
  end
  
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/spec/actions/input_action_spec.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/spec/actions/input_action_spec.rb
formtastic-4.0.0 spec/actions/input_action_spec.rb
formtastic-4.0.0.rc1 spec/actions/input_action_spec.rb