Skip to content

@lukeredpath /test.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Using Mocha's state machines
class FakeResource # fake RestClient::Resource
attr_reader :path
def initialize(path = "/")
@path = Mocha::Mockery.instance.new_state_machine("location").starts_as(path)
end
def [](path)
tap { @path.become(path) }
end
end
describe "Github::Client" do
before(:each) do
@resource = FakeResource.new
@client = Github::Client.new(@resource)
end
describe "#get" do
it "performs a GET request to /some/path on the resource" do
@resource.expects(:get).when @resource.path.is("/some/path")
@client.get("/some/path")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.