Sha256: a760fd47b7dc8b336f0ed6f07081a697b2df248d9eb42c997788be5648094e88

Contents?: true

Size: 1.18 KB

Versions: 62

Compression:

Stored size: 1.18 KB

Contents

require 'test_helper'
require 'generators/workarea/decorator/decorator_generator'

module Workarea
  class DecoratorGeneratorTest < GeneratorTest
    tests Workarea::DecoratorGenerator
    destination Dir.mktmpdir

    setup do
      prepare_destination
    end

    def test_decorator
      run_generator %w(app/models/workarea/search/storefront/product.rb)
      assert_file 'app/models/workarea/search/storefront/product.decorator' do |decorator|
        assert_match('decorate Search::Storefront::Product', decorator)
      end
    end

    def test_test_decorator_generation
      run_generator %w(app/models/workarea/search/storefront/product.rb)
      assert_file 'test/models/workarea/search/storefront/product_test.decorator' do |test|
        assert_match("require 'test_helper'", test)
        assert_match('decorate Search::Storefront::ProductTest', test)
      end
    end

    def test_decorating_test
      run_generator %w(test/integration/workarea/authentication_test.rb)
      assert_file 'test/integration/workarea/authentication_test.decorator' do |test|
        assert_match("require 'test_helper'", test)
        assert_match('decorate AuthenticationTest', test)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 test/generators/workarea/decorator_generator_test.rb
workarea-core-3.4.12 test/generators/workarea/decorator_generator_test.rb