Sha256: dbe7f42943f1f1789631a523b64853fc34e9995c243e07431ff468307660f805
Contents?: true
Size: 1.61 KB
Versions: 3
Compression:
Stored size: 1.61 KB
Contents
<body id="snapshots_index" <%= refresh_controller %>> <h1>Snapshots</h1> <% if @grouped_by_test_class.empty? %> <p> In your integration tests, once a request has been made, add <code>#take_screenshot</code>. Run the tests with <code>TAKE_SNAPSHOTS=1</code>, and the snapshot will appear here. </p> <p>Look below at an example integration test.</p> <pre> require "minitest/autorun" require "rack/test" require "application" <mark>require "snapshot_ui/test/minitest_helpers"</mark> class ApplicationTest < Minitest::Spec include Rack::Test::Methods <mark>include SnapshotUI::Test::MinitestHelpers</mark> def app @app ||= Application.new end it "renders the root page" do get "/" <mark>take_snapshot last_response</mark> _(last_response.body).must_match("To see a world in a grain of sand...") end end </pre> <p> To activate live updates for this page, execute the following command in your terminal.<br> </p> <pre> bundle exec snapshot_ui watch SNAPSHOT_DIRECTORY</pre> <p> where <code>SNAPSHOT_DIRECTORY</code> is a path to a directory that contains snapshot UI data, e.g. <code>tmp/snapshot_ui</code>. </p> <% end %> <% @grouped_by_test_class.each do |test_group, snapshots| %> <h2><%= test_group %></h2> <ul> <% snapshots.each do |snapshot| %> <li> <a href="<%= snapshot_path(snapshot.slug) %>"> <%= snapshot.context.name %> <%= if snapshot.context.take_snapshot_index > 0 then "(##{(snapshot.context.take_snapshot_index + 1)} in the same test)" end %> </a> </li> <% end %> </ul> <% end %> </body>
Version data entries
3 entries across 3 versions & 1 rubygems