Skip to content

Instantly share code, notes, and snippets.

@petelacey
Created October 7, 2012 16:25
Show Gist options
  • Save petelacey/3848819 to your computer and use it in GitHub Desktop.
Save petelacey/3848819 to your computer and use it in GitHub Desktop.
Testing a use case
require 'spec_helper_lite'
require 'sonian/use_cases/create_root_partner'
require 'sonian/use_cases/create_account'
require 'sonian/use_cases/create_user'
require 'sonian/persistence/memory_store'
module Sonian
describe CreateUser do
let(:gateway) { MemoryStore.new }
before do
partner = CreateRootPartner.new(gateway).with_attributes(:domain => 'sonian.net')
@account = CreateAccount.new(partner, gateway).with_attributes(:domain => 'bigbank.com')
end
it "can add a user to an account" do
user = CreateUser.new(@account, gateway).with_attributes(:username => 'foo', :password => 'bar')
assert_instance_of Sonian::User, user
assert_equal 'foo', user.username
refute user.password.empty?
end
# More tests ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment