File: test_unit_generator_test.rb

package info (click to toggle)
ruby-view-component 4.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,832 kB
  • sloc: ruby: 8,385; sh: 166; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 688 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require_relative "../../test_helper"
require "generators/view_component/test_unit/test_unit_generator"

class TestUnitGeneratorTest < Rails::Generators::TestCase
  tests ViewComponent::Generators::TestUnitGenerator
  destination Dir.mktmpdir
  setup :prepare_destination

  def test_component_tests
    run_generator %w[example --test-framework test_unit]

    assert_file "test/components/test_engine/example_component_test.rb" do |component|
      assert_no_match(/module/, component)
      assert_match(/class TestEngine::ExampleComponentTest < /, component)
      assert_match(/def test_component_renders_something_useful/, component)
    end
  end
end