Sha256: a0c2d3ef698f5357b2cbd64a345bcae8b738d044758af8bd3c6a975984e0f24f

Contents?: true

Size: 698 Bytes

Versions: 14

Compression:

Stored size: 698 Bytes

Contents

require 'test_helper'
require 'generators/rails/resource_override'

class ResourceGeneratorTest < Rails::Generators::TestCase
  destination File.expand_path('../../../tmp/generators', __FILE__)
  setup :prepare_destination, :copy_routes

  tests Rails::Generators::ResourceGenerator
  arguments %w(account)

  def test_serializer_file_is_generated
    run_generator

    assert_file 'app/serializers/account_serializer.rb', /class AccountSerializer < ActiveModel::Serializer/
  end

  private

  def copy_routes
    config_dir = File.join(destination_root, 'config')
    FileUtils.mkdir_p(config_dir)
    File.write(File.join(config_dir, 'routes.rb'), 'Rails.application.routes.draw {}')
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
active_model_serializers-0.10.8 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.7 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.6 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.5 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.4 test/generators/scaffold_controller_generator_test.rb
agi_active_model_serializers-0.10.9 test/generators/scaffold_controller_generator_test.rb
agi_active_model_serializers-0.10.8 test/generators/scaffold_controller_generator_test.rb
agi_active_model_serializers-0.10.7 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.3 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.2 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.1 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.0 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.0.rc5 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.0.rc4 test/generators/scaffold_controller_generator_test.rb