HTMLAssertion v0.1.3 HTMLAssertion.DSL View Source

Add additional syntax to passing current context inside block

Example: pass context

assert_select html, ".container" do
  assert_select "form", action: "/users" do
    refute_select ".flash_message"
    assert_select ".control_group" do
      assert_select "label", class: "title", text: ~r{Full name}
      assert_select "input", class: "control", type: "text"
    end
    assert_select("a", text: "Submit", class: "button")
  end
  assert_select ".user_list" do
    assert_select "li"
  end
end

Example 2: print current context for debug

assert_select(html, ".selector") do
  IO.inspect(assert_select, label: "current context html")
end

Link to this section Summary

Link to this section Functions

Link to this macro

assert_select(context, selector \\ nil, attributes \\ nil, maybe_do_block \\ nil) View Source (macro)

Link to this macro

refute_select(context, selector \\ nil, attributes \\ nil, maybe_do_block \\ nil) View Source (macro)