Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@panthomakos
Created January 26, 2012 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panthomakos/1685236 to your computer and use it in GitHub Desktop.
Save panthomakos/1685236 to your computer and use it in GitHub Desktop.
Simplified Version of user_presenter_spec.rb from DestroyAllSoftware
class Module
alias :let :define_method
end
UserPresenter = Struct.new(:user) do
let(:full_name){ [user.first_name, user.last_name].join(' ') }
end
describe UserPresenter do
let(:user){ stub(:user, :first_name => 'Bob', :last_name => 'Smith') }
it "presents user's full name" do
UserPresenter.new(user).full_name.should == 'Bob Smith'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment