psyho / bogus

Fake library for Ruby
Other
359 stars 14 forks source link

Contract from documentation pass #26

Closed LTe closed 11 years ago

LTe commented 11 years ago

I'm not able to reproduce example from documentation click

class Library
  def initialize
    @books = []
  end

  def has_book?(book)
    @books.include?(book)
  end

  def checkout(book)
    @books.delete(book)
  end

  def return(book)
    @books << book
  end
end

require 'rspec'
require 'bogus/rspec'

describe Library do
  verify_contract(:library)

  let(:library) { Library.new }

  it "marks books as unavailable after they are checked out" do
    library.return("Moby Dick")

    library.checkout("Moby Dick")

    library.has_book?("Moby Dick").should be_false
  end
end

Rspec output:

.

Finished in 0.00331 seconds
1 example, 0 failures

But documentation says: spec file with following content should fail

psyho commented 11 years ago

That's because this is not the full example from the documentation. You forgot about the background: https://www.relishapp.com/bogus/bogus/v/0-1-2/docs/contract-tests/contract-tests-with-mocks#background

LTe commented 11 years ago

@psyho thanks. I will close this issue. But I think that bogus need mailing list/irc channel or other channel for questions or discussion.

Take care and thanks for bogus!

psyho commented 11 years ago

I believe you are right. I think we'll setup something soon.