Sha256: b731853d54e3c4f83aaf6374032a699bb35aa8957e04d3ee1ce2cb125361195b

Contents?: true

Size: 1007 Bytes

Versions: 8

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

require "rails/generators/test_case"
require_relative "../test_helper"

class StimulusReflexGeneratorTest < Rails::Generators::TestCase
  tests StimulusReflexGenerator
  destination File.expand_path("../../tmp", __FILE__)
  setup :prepare_destination

  test "creates singular named controller and reflex files" do
    run_generator %w[demo]
    assert_file "app/javascript/controllers/application_controller.js"
    assert_file "app/javascript/controllers/demo_controller.js", /DemoReflex/
    assert_file "app/reflexes/application_reflex.rb"
    assert_file "app/reflexes/demo_reflex.rb", /DemoReflex/
  end

  test "creates plural named controller and reflex files" do
    run_generator %w[posts]
    assert_file "app/javascript/controllers/application_controller.js"
    assert_file "app/javascript/controllers/posts_controller.js", /PostsReflex/
    assert_file "app/reflexes/application_reflex.rb"
    assert_file "app/reflexes/posts_reflex.rb", /PostsReflex/
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
stimulus_reflex-3.2.3 test/generators/stimulus_reflex_generator_test.rb
stimulus_reflex-3.2.2 test/generators/stimulus_reflex_generator_test.rb
stimulus_reflex-3.2.2.pre1 test/generators/stimulus_reflex_generator_test.rb
stimulus_reflex-3.2.2.pre0 test/generators/stimulus_reflex_generator_test.rb
stimulus_reflex-3.2.1 test/generators/stimulus_reflex_generator_test.rb
stimulus_reflex-3.2.0 test/generators/stimulus_reflex_generator_test.rb
stimulus_reflex-3.2.0.pre1 test/generators/stimulus_reflex_generator_test.rb
stimulus_reflex-3.2.0.pre0 test/generators/stimulus_reflex_generator_test.rb