Sha256: c709bc3626cf28ac1e36097148ba9a6f92b11ad4074aa5be9835bbfb27ab773e
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require "minitest" module Pages module Testing class Capybara < ApplicationPage def template render Layout.new(title: "Testing with Capybara") do render Markdown.new(<<~MD) # Testing with Capybara Require `phlex/testing/capybara` and include `Phlex::Testing::Capybara::ViewHelper` to use [Capybara](http://teamcapybara.github.io/capybara/) matchers. The `render` method will return a `Capybara::Node::Simple` and set the `page` attribute to the result. MD render Example.new do |e| e.tab "test.rb", <<~RUBY require "phlex/testing/capybara" class TestExample < Minitest::Test include Phlex::Testing::Capybara::ViewHelper def test_example render Example.new("Joel") assert_select "h1", text: "Hello Joel" end end RUBY e.tab "hello.rb", <<~RUBY class Hello < Phlex::HTML def initialize(name) @name = name end def template h1 { "Hello \#{@name}" } end end RUBY end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
phlex-0.5.3 | docs/pages/testing/capybara.rb |
phlex-0.5.2 | docs/pages/testing/capybara.rb |
phlex-0.5.1 | docs/pages/testing/capybara.rb |
phlex-0.5.0 | docs/pages/testing/capybara.rb |