Skip to content

Commit

Permalink
Merge pull request #244 from github/generator
Browse files Browse the repository at this point in the history
placeholder test should use correct syntax
  • Loading branch information
joelhawksley authored Mar 3, 2020
2 parents da516ce + ceec769 commit 51b9c90
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# master

* Fix bug where generator created invalid test code.

*Joel Hawksley*

# v1.14.0

* Rename ActionView::Component::Base to ViewComponent::Base
Expand Down
2 changes: 1 addition & 1 deletion lib/rails/generators/rspec/templates/component_spec.rb.tt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RSpec.describe <%= class_name %>Component, type: :component do

# it "renders something useful" do
# expect(
# render_inline(described_class, attr: "value") { "Hello, components!" }.css("p").to_html
# render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
# ).to include(
# "Hello, components!"
# )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class <%= class_name %>ComponentTest < ViewComponent::TestCase
test "component renders something useful" do
# assert_equal(
# %(<span title="my title">Hello, components!</span>),
# render_inline(<%= class_name %>Component, attr: "value") { "Hello, components!" }.css("span").to_html
# render_inline(<%= class_name %>Component.new(attr: "value")) { "Hello, components!" }.css("span").to_html
# )
end
end
2 changes: 1 addition & 1 deletion test/view_component/test_unit_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ViewComponent::TestUnitGeneratorTest < ::Rails::Generators::TestCase

test "generates component" do
assert_file "../tmp/test/components/dummy_component_test.rb" do |content|
assert_match(/render_inline\(DummyComponent, attr: "value"\) { "Hello, components!" }.css\("span"\).to_html/, content)
assert_match(/render_inline\(DummyComponent.new\(attr: "value"\)\) { "Hello, components!" }.css\("span"\).to_html/, content)
end
end
end

0 comments on commit 51b9c90

Please sign in to comment.