Sha256: 45acaa92c7727387d20b8915f44d9fcfc5c07d04b55dc5dcd3a33ae978576cdd

Contents?: true

Size: 921 Bytes

Versions: 1

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'
require 'rails/generators/test_case'
require 'generators/upgrow/model/model_generator'

module Upgrow
  module Generators
    class ModelGeneratorTest < Rails::Generators::TestCase
      tests ModelGenerator
      destination File.expand_path('tmp')
      setup :prepare_destination

      test 'generate Model file' do
        run_generator(['article'])

        assert_file 'app/models/article.rb', <<~RUBY
          # frozen_string_literal: true

          class Article < ApplicationModel
          end
        RUBY
      end

      test 'generate namespaced Model file' do
        run_generator(['articles/article'])

        assert_file 'app/models/articles/article.rb', <<~RUBY
          # frozen_string_literal: true

          module Articles
            class Article < ApplicationModel
            end
          end
        RUBY
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
upgrow-0.0.5 test/upgrow/generators/model_generator_test.rb