The `type: :feature` is automatically detected by RSpec because these tests are inside the `spec/features` folder. Using `feature` re-adds a `type: :feature` to these files, which will result in a conflict when we upgrade to Rails 5.1's system tests. Because of this change, we also need to change `background` to `before` or else these tests will fail. We're also adding a rubocop rule so we dont' accidentally add these keywords again.
33 lines
760 B
Ruby
33 lines
760 B
Ruby
require "rails_helper"
|
|
|
|
describe "Tracking budgets" do
|
|
|
|
before do
|
|
@tracker = create(:tracker, user: create(:user, username: "Rachel",
|
|
email: "rachel@trackers.org"))
|
|
login_as(@tracker.user)
|
|
end
|
|
|
|
scenario "Disabled with a feature flag" do
|
|
Setting["process.budgets"] = nil
|
|
expect{ visit tracking_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
|
end
|
|
|
|
context "Index" do
|
|
|
|
scenario "Displaying budgets" do
|
|
budget = create(:budget)
|
|
visit tracking_budgets_path
|
|
|
|
expect(page).to have_content(budget.name)
|
|
end
|
|
|
|
scenario "With no budgets" do
|
|
visit tracking_budgets_path
|
|
|
|
expect(page).to have_content "There are no budgets"
|
|
end
|
|
end
|
|
|
|
end
|