forked from shakacode/react-webpack-rails-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact_router_demo_spec.rb
26 lines (25 loc) · 966 Bytes
/
react_router_demo_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require "rails_helper"
require "system/shared/contexts"
feature "React Router Routes", js: true, type: :system do
context "Root URL", page: :main do
it "shows comments section" do
click_link "Comments (Root URL)"
expect(page).to have_selector("h2", text: "Comments")
end
end
context "/react-router URL", page: :main do
it "shows 'React Router is working!' message" do
click_link "Test React Router ('/react-router')"
expect(page).to have_selector("h1", text: "React Router is working!")
end
end
context "/react-router/redirect URL", page: :main do
before { click_link "Test Redirect (url to '/react-router/redirect' which goes to root '/')" }
it "shows comments section" do
expect(page).to have_selector("h2", text: "Comments")
end
it "shows redirect message" do
expect(page).to have_selector(".bg-success", text: "You have been redirected from/react-router/redirect")
end
end
end