Sha256: 3bd7eccba466894477b91269e7b3e56988a03cea91e5b00639216ec36a073abd

Contents?: true

Size: 1.07 KB

Versions: 37

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

require "generators/devise/devise_generator"

class DeviseGeneratorTest < Rails::Generators::TestCase
  tests Devise::Generators::DeviseGenerator
  destination File.expand_path("../../tmp", __FILE__)

  setup do
    prepare_destination
    copy_routes
  end

  test "route generation for simple model names" do
    run_generator %w(monster name:string)
    assert_file "config/routes.rb", /devise_for :monsters/
  end

  test "route generation for namespaced model names" do
    run_generator %w(monster/goblin name:string)
    match = /devise_for :goblins, class_name: "Monster::Goblin"/
    assert_file "config/routes.rb", match
  end

  test "route generation with skip routes" do
    run_generator %w(monster name:string --skip-routes)
    match = /devise_for :monsters, skip: :all/
    assert_file "config/routes.rb", match
  end

  def copy_routes
    routes = File.expand_path("../../rails_app/config/routes.rb", __FILE__)
    destination = File.join(destination_root, "config")

    FileUtils.mkdir_p(destination)
    FileUtils.cp routes, destination
  end

end

Version data entries

37 entries across 37 versions & 7 rubygems

Version Path
devise-4.3.0 test/generators/devise_generator_test.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/devise-4.2.1/test/generators/devise_generator_test.rb
devise-4.2.1 test/generators/devise_generator_test.rb
devise-4.2.0 test/generators/devise_generator_test.rb
devise-3.5.10 test/generators/devise_generator_test.rb
devise-4.0.3 test/generators/devise_generator_test.rb
devise-4.1.1 test/generators/devise_generator_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/devise-4.1.0/test/generators/devise_generator_test.rb
devise-4.1.0 test/generators/devise_generator_test.rb
devise-3.5.9 test/generators/devise_generator_test.rb
devise-4.0.2 test/generators/devise_generator_test.rb
devise-4.0.1 test/generators/devise_generator_test.rb
devise-3.5.8 test/generators/devise_generator_test.rb
devise-3.5.7 test/generators/devise_generator_test.rb
devise-4.0.0 test/generators/devise_generator_test.rb
devise-4.0.0.rc2 test/generators/devise_generator_test.rb
devise-4.0.0.rc1 test/generators/devise_generator_test.rb
devise-3.5.6 test/generators/devise_generator_test.rb
devise-3.5.5 test/generators/devise_generator_test.rb
devise-3.5.4 test/generators/devise_generator_test.rb