Created
July 24, 2017 14:08
-
-
Save eviltrout/ab64b12389b44483a91f6862416f9c95 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
describe Synchronizer do | |
class TestSynchorizer < Synchronizer | |
def initialize(can_sync) | |
@can_sync = can_sync | |
@performed = false | |
end | |
def can_sync? | |
@can_sync | |
end | |
def perform_sync | |
@performed = true | |
end | |
def performed? | |
@performed | |
end | |
end | |
describe "#perform" do | |
it "performs when can_sync returns true" do | |
ts = TestSynchronizer.new(true) | |
ts.sync | |
expect(ts.performed?).to eq(true) | |
end | |
it "doesn't perform when can_sync returns true" do | |
ts = TestSynchronizer.new(false) | |
ts.sync | |
expect(ts.performed?).to eq(false) | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aaah wow okay! So you are building the whole synchronizer as a test version!