Sha256: 668d385f1434e3986539846cf2447dc7ce48d7b49114c9a9bbcc78dfe1f0ef99

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

# Generators are not automatically loaded by Rails
require 'generators/formtastic/install/install_generator'

RSpec.describe Formtastic::InstallGenerator do
  # Tell the generator where to put its output (what it thinks of as Rails.root)
  destination File.expand_path("../../../../../tmp", __FILE__)

  before { prepare_destination }

  describe 'no arguments' do
    before { run_generator  }

    describe 'config/initializers/formtastic.rb' do
      subject { file('config/initializers/formtastic.rb') }
      it { is_expected.to exist }
      it { is_expected.to contain "#" }
    end

    describe 'lib/templates/erb/scaffold/_form.html.erb' do
      subject { file('lib/templates/erb/scaffold/_form.html.erb') }
      it { is_expected.to exist }
      it { is_expected.to contain "<%%= semantic_form_for @<%= singular_name %> do |f| %>" }
    end
  end

  describe 'haml' do
    before { run_generator %w(--template-engine haml) }

    describe 'lib/templates/erb/scaffold/_form.html.haml' do
      subject { file('lib/templates/haml/scaffold/_form.html.haml') }
      it { is_expected.to exist }
      it { is_expected.to contain "= semantic_form_for @<%= singular_name %> do |f|" }
    end
  end

  describe 'slim' do
    before { run_generator %w(--template-engine slim) }

    describe 'lib/templates/erb/scaffold/_form.html.slim' do
      subject { file('lib/templates/slim/scaffold/_form.html.slim') }
      it { is_expected.to exist }
      it { is_expected.to contain "= semantic_form_for @<%= singular_name %> do |f|" }
    end
  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/generators/formtastic/install/install_generator_spec.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/spec/generators/formtastic/install/install_generator_spec.rb
formtastic-4.0.0 spec/generators/formtastic/install/install_generator_spec.rb
formtastic-4.0.0.rc1 spec/generators/formtastic/install/install_generator_spec.rb