Sha256: 56caac63156a3e36878624d84f04bc1cce75ad74bc21f095f7569fd97b8b5567

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class ResourceOverrideTest < Rails::Generators::TestCase
  include GeneratorTestSupport

  tests Rails::Generators::ResourceGenerator
  destination File.join(Rails.root, "tmp")
  setup :prepare_destination, :copy_router, :copy_routes

  test "create template without ember" do
    run_generator ["post"]
    assert_no_file "#{app_path}/templates/posts.hbs"
  end

  test "create template with ember" do
    run_generator ["post", '--ember']
    assert_file "#{app_path}/templates/posts.hbs"
  end

  test "does not create non-essential files for ember apps" do
    run_generator ["post", "title:string"]
    assert_no_file "#{app_path}/assets/javascripts/posts.js"
    assert_no_file "#{app_path}/helpers/posts_helper.rb"
    assert_no_directory "#{app_path}/views/posts"
  end

  private

  def copy_routes
    routes = File.expand_path("../../dummy/config/routes.rb", __FILE__)
    destination = File.expand_path('../../dummy/tmp/config', __FILE__)
    FileUtils.mkdir_p(destination)
    FileUtils.cp routes, destination
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ember-appkit-rails-0.3.2 test/generators/resource_override_test.rb
ember-appkit-rails-0.3.1 test/generators/resource_override_test.rb
ember-appkit-rails-0.3.0 test/generators/resource_override_test.rb