Sha256: 15db4cba5f076948011615f9ef6d2fe65dfde4b0da0e467faa8ec1ceb73e4811

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

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

2 entries across 2 versions & 2 rubygems

Version Path
active_model_serializers_custom-0.10.90 test/generators/scaffold_controller_generator_test.rb
active_model_serializers-0.10.9 test/generators/scaffold_controller_generator_test.rb