/
account_spec.rb
42 lines (32 loc) · 1.07 KB
/
account_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'spec_helper'
describe Account do
# jokka palm
static_methods do
new do
describe_return("Account with 0 USD") do
# it_behaves_like "Account with 0 USD" can also be used
it("has #balance == 0") { subject.balance.should == 0 }
it("has #currency == 'USD") { subject.currency.should == 'USD' }
end
end
# can also use the static_method instead of calling with new
new(arg(:amount), arg(:currency)) do
# scenario 'account and currency has valid values' do
given do
arg.amount = 50
arg.currency = 'USD'
# subject{}
end
describe_return "an Account with given amount and currency" do
it { subject.balance.should == 50 } #given.amount }
it { subject.currency.should == 'USD'} # given.currency }
end
end
# end
end
end
# it_behaves_like "Account with 0 USD"
# share_examples_for "Account with 0 USD" do
# it("has #balance == 0") { subject.balance.should == 0}
# it("has #currency == 'USD") { subject.currency.should == 'USD'}
# end