Add (very simple) spec for a ViewComponent component

- Add `ViewComponent::TestHelpers` to get the helper method `render_inline`
 - Use Capybara to expect some assertion
This commit is contained in:
Jean-Baptiste Bellet
2021-04-09 10:56:19 +02:00
parent 6c37461c37
commit 390c8a89da
2 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
require "spec_helper"
describe "ExampleComponent tests", type: :component do
it "displays the h1 with the given parameter" do
render_inline(ExampleComponent.new(title: "Hello")) { }
expect(page).to have_selector "h1", text: "Hello"
end
end