Created
July 20, 2010 12:43
-
-
Save balinterdi/482904 to your computer and use it in GitHub Desktop.
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
require "user_creation_service" | |
require "spec" | |
require "rr" | |
Spec::Runner.configure do |config| | |
config.mock_with RR::Adapters::Rspec | |
end | |
describe UserCreationService do | |
before do | |
@user = stub | |
@params = { :name => "Matz", :language => "Ruby" } | |
mock(@user_class = Object.new).create(@params) { @user } | |
mock(@log_class = Object.new).new_user(@user) | |
@service = UserCreationService.new(@user_class, @log_class) | |
@service.create(@params) | |
end | |
it "creates the user with the supplied parameters" do | |
@user_class.should have_received.create(@params) | |
end | |
it "logs the creation of the user" do | |
@log_class.should have_received.new_user(@user) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment