Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 42 lines (31 sloc) 1.052 kb
70cec86 @dchelimsky words again
dchelimsky authored
1 == RSpec
4cff475 @dchelimsky remove everything but rspec (core) from main rspec repo
dchelimsky authored
2
4e42338 @dchelimsky Stick a URI in the README to make hoe happy.
dchelimsky authored
3 http://rspec.info
4
ea9d975 @dchelimsky less words is more
dchelimsky authored
5 Behaviour Driven Development for Ruby
4cff475 @dchelimsky remove everything but rspec (core) from main rspec repo
dchelimsky authored
6
610f022 @dchelimsky words
dchelimsky authored
7 This is the repository for rspec-1.x. If you're looking
8 for rspec-2 (and if you're not, what are you waiting for?),
9 see http://github.com/rspec/rspec
10
70cec86 @dchelimsky words again
dchelimsky authored
11 == Install
4cff475 @dchelimsky remove everything but rspec (core) from main rspec repo
dchelimsky authored
12
ea9d975 @dchelimsky less words is more
dchelimsky authored
13 gem install rspec
4cff475 @dchelimsky remove everything but rspec (core) from main rspec repo
dchelimsky authored
14
70cec86 @dchelimsky words again
dchelimsky authored
15 == Synopsis
4cff475 @dchelimsky remove everything but rspec (core) from main rspec repo
dchelimsky authored
16
f71c084 @dchelimsky rdoc cleanup
dchelimsky authored
17 describe Account do
18 context "transfering money" do
19 it "deposits transfer amount to the other account" do
20 source = Account.new(50, :USD)
21 target = mock('target account')
22 target.should_receive(:deposit).with(Money.new(5, :USD))
23 source.transfer(5, :USD).to(target)
24 end
25
26 it "reduces its balance by the transfer amount" do
27 source = Account.new(50, :USD)
28 target = stub('target account')
29 source.transfer(5, :USD).to(target)
30 source.balance.should == Money.new(45, :USD)
31 end
85f842c @dchelimsky update README
dchelimsky authored
32 end
33 end
f71c084 @dchelimsky rdoc cleanup
dchelimsky authored
34
ea9d975 @dchelimsky less words is more
dchelimsky authored
35 $ spec ./spec/account_spec.rb --format nested
f71c084 @dchelimsky rdoc cleanup
dchelimsky authored
36 Account
37 transfering money
38 deposits transfer amount to the other account
39 reduces its balance by the transfer amount
85f842c @dchelimsky update README
dchelimsky authored
40
f71c084 @dchelimsky rdoc cleanup
dchelimsky authored
41 2 examples, 0 failures
Something went wrong with that request. Please try again.