Sha256: 4bc7834766b1dadec338841bed033dc1cd2fc8ff8df0dfdcf46dfb72eecce79a

Contents?: true

Size: 1.36 KB

Versions: 17

Compression:

Stored size: 1.36 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_categories_files
    run_generator
    assert_migration 'db/migrate/create_adminpanel_categories_table.rb'
    assert_file 'app/models/adminpanel/category.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( -c true -u true -m true -p true )
    assert_no_file 'config/initializers/adminpanel_setup.rb'
    assert_no_file 'app/models/adminpanel/category.rb'
    assert_no_migration 'db/migrate/create_adminpanel_categories_table.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

17 entries across 17 versions & 1 rubygems

Version Path
adminpanel-2.4.3 test/generators/initialize_generator_test.rb
adminpanel-2.4.2 test/generators/initialize_generator_test.rb
adminpanel-2.4.1 test/generators/initialize_generator_test.rb
adminpanel-2.4.0 test/generators/initialize_generator_test.rb
adminpanel-2.3.1 test/generators/initialize_generator_test.rb
adminpanel-2.3.0 test/generators/initialize_generator_test.rb
adminpanel-2.2.5 test/generators/initialize_generator_test.rb
adminpanel-2.2.4 test/generators/initialize_generator_test.rb
adminpanel-2.2.3 test/generators/initialize_generator_test.rb
adminpanel-2.2.2 test/generators/initialize_generator_test.rb
adminpanel-2.2.1 test/generators/initialize_generator_test.rb
adminpanel-2.2.0 test/generators/initialize_generator_test.rb
adminpanel-2.1.7 test/generators/initialize_generator_test.rb
adminpanel-2.1.6 test/generators/initialize_generator_test.rb
adminpanel-2.1.5 test/generators/initialize_generator_test.rb
adminpanel-2.1.3 test/generators/initialize_generator_test.rb
adminpanel-2.1.2 test/generators/initialize_generator_test.rb