forked from jm/stump
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
96 additions
and
108 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Gemfile.lock |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AppDelegate | ||
def application(application, didFinishLaunchingWithOptions:launchOptions) | ||
true | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Stump | ||
module Baconize | ||
module ContextExtensions | ||
def self.included(base) | ||
base.class_eval do | ||
alias_method :it_without_mock_verification, :it | ||
alias_method :it, :it_with_mock_verification | ||
end | ||
end | ||
|
||
def verify_mocks | ||
puts "verify_mocks" | ||
if !Stump::Mocks.failures.nil? && !Stump::Mocks.failures.empty? | ||
fails = Stump::Mocks.failures.map {|object, method| "#{object.inspect} expected #{method}"}.join(", ") | ||
should.flunk "Unmet expectations: #{fails}" | ||
end | ||
end | ||
|
||
def it_with_mock_verification(description, &block) | ||
@after << proc { verify_mocks } | ||
it_without_mock_verification(description, &block) | ||
ensure | ||
Stump::Mocks.clear! | ||
end | ||
end | ||
end | ||
end | ||
|
||
begin | ||
Bacon::Context.class_eval { include Stump::Baconize::ContextExtensions } | ||
rescue LoadError | ||
puts 'Bacon is not available.' | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
describe "Application 'stump-test'" do | ||
class Hello | ||
end | ||
|
||
it "stub on object" do | ||
Hello.stub!(:thing, :return => "hey!") | ||
Hello.should.not.be.nil | ||
Hello.thing.should == "hey!" | ||
|
||
my_obj = Object.new | ||
my_obj.stub!(:hello) | ||
my_obj.hello.should.be.nil | ||
end | ||
|
||
it "should create pure stub" do | ||
my_stub = stub(:thing, :return => "dude, a thing!") | ||
my_stub.thing.should == "dude, a thing!" | ||
end | ||
|
||
it "should mock object" do | ||
my_object = "things are fun" | ||
my_object.mock!(:fancy, :return => "ooo fancy!") | ||
my_object.mock!(:tancy, :return => "ooo tancy!") | ||
my_object.fancy.should == 'ooo fancy!' | ||
end | ||
|
||
# it "should create pure mock" do | ||
# my_mock = mock(:hello, :return => "what fun is this?") | ||
# my_mock.hello.should == "what fun is this?" | ||
# end | ||
|
||
# class Greeting | ||
# def bonjour | ||
# "Bonjour!" | ||
# end | ||
# end | ||
|
||
# it "should use proxy objects" do | ||
# greet_me = Greeting.new | ||
# greet_me.proxy!(:bonjour) | ||
# greet_me.bonjour # => "Bonjour!" | ||
# end | ||
|
||
end |