Created
October 18, 2012 19:05
-
-
Save shepmaster/3914134 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
PredictionGatekeeper | |
viewing predictions | |
a third party cannot see the prediction | |
before the prediction due date | |
the creator can reveal the prediction | |
the victim can only view prediction metadata | |
after the prediction due date | |
the creator can view the prediction | |
the victim can view the prediction | |
revealing predictions | |
the creator can reveal a prediction | |
anyone else cannot reveal a prediction |
This file contains hidden or 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 PredictionGatekeeper do | |
let(:creator) { Fabricate(:user, email: '[email protected]') } | |
let(:victim) { Fabricate(:user, email: '[email protected]') } | |
let(:prediction) { Fabricate(:prediction, creator: creator, victim: victim) } | |
let(:listener) { double("listener") } | |
before(:each) do | |
@gatekeeper = PredictionGatekeeper.new(prediction, listener) | |
end | |
context "viewing predictions" do | |
context "before the prediction due date" do | |
before(:each) { prediction.due_date = DateTime.now + 5.minutes } | |
it "the creator can reveal the prediction" do | |
listener.should_receive(:can_reveal_prediction) | |
@gatekeeper.may_view(creator) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment