Files
nairobi/spec/controllers/application_controller_spec.rb
Javi Martín bd795be80e Check for attribute values in current budget tests
Assigning a variable to each budget we declare results in useless
assignments. We could just delete the three useless assignments and
leave the fourth one, but I find the code easier to read if we use the
name of the budgets to differenciate between them. This way we also keep
the code vertically aligned.
2019-09-30 14:29:15 +02:00

20 lines
573 B
Ruby

require "rails_helper"
describe ApplicationController do
describe "#current_budget" do
it "returns the last budget that is not in draft phase" do
create(:budget, :finished, created_at: 2.years.ago, name: "Old")
create(:budget, :accepting, created_at: 1.year.ago, name: "Previous")
create(:budget, :accepting, created_at: 1.month.ago, name: "Current")
create(:budget, :drafting, created_at: 1.week.ago, name: "Next")
budget = subject.instance_eval { current_budget }
expect(budget.name).to eq("Current")
end
end
end