Sha256: 1667637454ea53135eb0cee63f15352bbc7e1f27ca066769483a597a3c16068c

Contents?: true

Size: 720 Bytes

Versions: 14

Compression:

Stored size: 720 Bytes

Contents

require 'test_helper'
require 'rails'
require 'active_model/serializer/railtie'
require 'test_app'

class ResourceGeneratorTest < Rails::Generators::TestCase
  destination File.expand_path('../../../tmp', __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 & 1 rubygems

Version Path
active_model_serializers-0.9.13 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.12 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.11 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.9 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.8 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.7 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.6 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.5 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.4 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.3 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.2 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.1 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.0 test/integration/generators/resource_generator_test.rb
active_model_serializers-0.9.0.alpha1 test/integration/generators/resource_generator_test.rb