Sha256: 7d6f1491b3317613274f25185018b0ff976fae1f44abe41da10e950256cbc2e7

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'
require 'generators/adminpanel/initialize/initialize_generator'

class InitializeGeneratorTest < Rails::Generators::TestCase
  tests Adminpanel::InitializeGenerator
  destination Rails.root.join('tmp/generators')
  setup :prepare_destination

  def test_the_generation_of_initial_migration
    run_generator
    assert_migration 'db/migrate/create_adminpanel_tables'
  end

  def test_the_generation_of_the_adminpanel_setup_file
    run_generator
    assert_file 'config/initializers/adminpanel_setup.rb'
  end

  def test_the_generation_of_the_section_uploader
    run_generator
    assert_file 'app/uploaders/adminpanel/section_uploader.rb'
  end

  def test_the_not_generation_of_files
    run_generator %w( -u true -m true -p true )
    assert_no_file 'config/initializers/adminpanel_setup.rb'
    assert_no_migration 'db/migrate/create_adminpanel_tables'
    assert_no_file 'app/uploaders/adminpanel/section_uploader.rb'
  end

  def test_runs_without_errors
    assert_nothing_raised do
      run_generator
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adminpanel-2.5.5 test/generators/initialize_generator_test.rb
adminpanel-2.5.4 test/generators/initialize_generator_test.rb
adminpanel-2.5.3 test/generators/initialize_generator_test.rb
adminpanel-2.5.2 test/generators/initialize_generator_test.rb
adminpanel-2.5.1 test/generators/initialize_generator_test.rb
adminpanel-2.5.0 test/generators/initialize_generator_test.rb