-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New testing module #774
New testing module #774
Conversation
if defined?(Minitest::Test) && Minitest::Test > mod | ||
require "capybara/minitest" | ||
include Capybara::Minitest::Assertions | ||
end | ||
|
||
if defined?(RSpec::Core::ExampleGroup) && RSpec::Core::ExampleGroup > mod | ||
require "capybara/rspec" | ||
include Capybara::RSpecMatchers | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatically detect which testing framework you’re using an include relevant matchers / assertions.
attr_reader :page | ||
alias_method :component, :page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to have page
for the built in capybara matchers, but you may want to refer to it as component
.
def render_fragment(...) | ||
::Nokogiri::HTML5.fragment( | ||
render_to_string(...), | ||
) | ||
end | ||
|
||
def render_document(...) | ||
::Nokogiri::HTML5( | ||
render_to_string(...), | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Nokogiri and Nokolexbor, you need to specify if you’re rendering a document or a fragment.
Introducing a new testing module to replace the external gems
phlex-testing-capybara
andphlex-testing-nokogiri
.