Created
December 16, 2011 16:45
-
-
Save ashmoran/1486811 to your computer and use it in GitHub Desktop.
Nesting contexts to build up a "when"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "#current_report" do | |
its(:current_report) { should be == report } | |
context "with a new" do | |
let(:new_report) { Report.make(state: new_report_state, project_date: new_report_date) } | |
before(:each) do | |
subject.reports << new_report | |
end | |
context "published" do | |
let(:new_report_state) { :published } | |
context "more recent report" do | |
let(:new_report_date) { Date.today + 1 } | |
its(:current_report) { should be == new_report } | |
end | |
context "older report" do | |
let(:new_report_date) { Date.today - 1 } | |
its(:current_report) { should be == report } | |
end | |
end | |
context "unpublished more recent report" do | |
let(:new_report_state) { :approved } | |
let(:new_report_date) { Date.today + 1 } | |
its(:current_report) { should be == report } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment