Sha256: 6a3052ed0dfce46bc50affcd0f730d34a4efd0db0c377da3e8fb557ec565c757

Contents?: true

Size: 715 Bytes

Versions: 14

Compression:

Stored size: 715 Bytes

Contents

require 'test_helper'
require 'generators/guts/routes/routes_generator'

module Guts
  class RoutesGeneratorTest < Rails::Generators::TestCase
    tests Guts::RoutesGenerator
    destination Rails.root.join('tmp/generators/routes')
    setup :prepare_destination

    test 'generator injects routes' do
      config_dir = "#{destination_root}/config"
      FileUtils.mkdir_p(config_dir)

      File.open("#{config_dir}/routes.rb", 'w+') do |f|
        f.write %(
Rails.application.routes.draw do
  resource :blog
end
)
      end

      run_generator ['--pathname=dashboard']

      assert_file "#{config_dir}/routes.rb", /Guts::Engine/
      assert_file "#{config_dir}/routes.rb", %r{\/dashboard}
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
guts-3.0.1 test/lib/generators/guts/routes_generator_test.rb
guts-3.0.0 test/lib/generators/guts/routes_generator_test.rb
guts-2.1.0 test/lib/generators/guts/routes_generator_test.rb
guts-2.0.2 test/lib/generators/guts/routes_generator_test.rb
guts-2.0.1 test/lib/generators/guts/routes_generator_test.rb
guts-2.0.0 test/lib/generators/guts/routes_generator_test.rb
guts-1.4.0 test/lib/generators/guts/routes_generator_test.rb
guts-1.3.6 test/lib/generators/guts/routes_generator_test.rb
guts-1.3.5 test/lib/generators/guts/routes_generator_test.rb
guts-1.3.4 test/lib/generators/guts/routes_generator_test.rb
guts-1.3.3 test/lib/generators/guts/routes_generator_test.rb
guts-1.3.2 test/lib/generators/guts/routes_generator_test.rb
guts-1.3.1 test/lib/generators/guts/routes_generator_test.rb
guts-1.3.0 test/lib/generators/guts/routes_generator_test.rb