Skip to content

Instantly share code, notes, and snippets.

@eviltrout
Created July 24, 2017 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eviltrout/ab64b12389b44483a91f6862416f9c95 to your computer and use it in GitHub Desktop.
Save eviltrout/ab64b12389b44483a91f6862416f9c95 to your computer and use it in GitHub Desktop.
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
@kajatiger
Copy link

aaah wow okay! So you are building the whole synchronizer as a test version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment