Use system specs instead of feature specs

We get rid of database cleaner, and JavaScript tests are faster because
between tests we now rollback transactions instead of truncating the
database.
This commit is contained in:
Javi Martín
2019-04-29 12:26:17 +02:00
parent 12774c7484
commit 9427f01442
190 changed files with 14 additions and 54 deletions

View File

@@ -0,0 +1,45 @@
shared_examples "progressable" do |factory_name, path_name|
describe "Progress bars", :js do
let!(:progressable) { create(factory_name) }
let(:path) { send(path_name, *resource_hierarchy_for(progressable)) }
scenario "With main progress bar" do
create(:progress_bar, progressable: progressable)
visit path
find("#tab-milestones-label").click
within("#tab-milestones") do
expect(page).to have_content "Progress"
end
end
scenario "With main and secondary progress bar" do
create(:progress_bar, progressable: progressable)
create(:progress_bar, :secondary, progressable: progressable, title: "Build laboratory")
visit path
find("#tab-milestones-label").click
within("#tab-milestones") do
expect(page).to have_content "Progress"
expect(page).to have_content "Build laboratory"
end
end
scenario "No main progress bar" do
create(:progress_bar, :secondary, progressable: progressable, title: "Defeat Evil Lords")
visit path
find("#tab-milestones-label").click
within("#tab-milestones") do
expect(page).not_to have_content "Progress"
expect(page).not_to have_content "Defeat Evil Lords"
end
end
end
end