+
+
+ Just a message
+
diff --git a/spec/matchers/have_alert_spec.rb b/spec/matchers/have_alert_spec.rb
index a51d0f7..b6c31b4 100644
--- a/spec/matchers/have_alert_spec.rb
+++ b/spec/matchers/have_alert_spec.rb
@@ -5,11 +5,19 @@
visit "/alert.html"
end
- it "matches using a custom matcher" do
+ it "matches using a custom matcher with locator" do
+ expect(page).to have_alert("Alert")
+ end
+
+ it "matches using a custom matcher with text: filter" do
expect(page).to have_alert(text: "Alert")
end
- it "matches using a negated custom matcher" do
+ it "matches using a negated custom matcher with locator" do
+ expect(page).to have_no_alert("foo")
+ end
+
+ it "matches using a negated custom matcher with text: filter" do
expect(page).to have_no_alert(text: "foo")
end
end
diff --git a/spec/matchers/have_status_spec.rb b/spec/matchers/have_status_spec.rb
new file mode 100644
index 0000000..7f63573
--- /dev/null
+++ b/spec/matchers/have_status_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+describe "have_status" do
+ before do
+ visit "/status.html"
+ end
+
+ it "matches using a custom matcher" do
+ expect(page).to have_status("Status")
+ expect(page).to have_status(text: "Status")
+ end
+
+ it "matches using a negated custom matcher" do
+ expect(page).to have_no_status("foo")
+ expect(page).to have_no_status(text: "foo")
+ end
+end
diff --git a/spec/selectors/alert_spec.rb b/spec/selectors/alert_spec.rb
index 540ff13..dbed7d3 100644
--- a/spec/selectors/alert_spec.rb
+++ b/spec/selectors/alert_spec.rb
@@ -5,7 +5,17 @@
visit "/alert.html"
end
- it "finds alerts" do
+ it "finds alerts without arguments" do
+ alert = page.find(:css, "[role=alert]")
+ expect(page.find(:alert)).to eq alert
+ end
+
+ it "finds alerts with a locator" do
+ alert = page.find(:css, "[role=alert]")
+ expect(page.find(:alert, "Alert message")).to eq alert
+ end
+
+ it "finds alerts with a text: filter" do
alert = page.find(:css, "[role=alert]")
expect(page.find(:alert, text: "Alert message")).to eq alert
end
diff --git a/spec/selectors/status_spec.rb b/spec/selectors/status_spec.rb
new file mode 100644
index 0000000..f773985
--- /dev/null
+++ b/spec/selectors/status_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+describe "status selector" do
+ before do
+ visit "/status.html"
+ end
+
+ it "finds statuses without arguments" do
+ status = page.find(:css, "[role=status]")
+ expect(page.find(:status)).to eq status
+ end
+
+ it "finds statuses with a locator" do
+ status = page.find(:css, "[role=status]")
+ expect(page.find(:status, "Status message")).to eq status
+ end
+
+ it "finds statuses with a text: filter" do
+ status = page.find(:css, "[role=status]")
+ expect(page.find(:status, text: "Status message")).to eq status
+ end
+
+ it "matches selector" do
+ status = page.find(:css, "[role=status]")
+ expect(status).to match_selector :status
+ end
+end