<br clear="all">Hi all !! <br> <p>I have this code: <br> require &#39;account&#39; <br> </p><p>describe Account, &quot;when first created&quot; do <br> &nbsp; before do <br> &nbsp; &nbsp; @account = Account.new <br> &nbsp; end <br> </p><p>&nbsp; it &quot;should have a balance of $0&quot; do 
<br> &nbsp; &nbsp; @account.balance.should eql(Money.new(0, :dollars)) <br> &nbsp; end <br> </p><p>&nbsp; after do <br> &nbsp; &nbsp; @account = nil <br> &nbsp; end <br> end <br> </p><p>How can I pass the @account.balance.should eql(Money.new(0, :dollars)) 
<br> spec. From my understanding you .eql? in ruby is true if the object <br> are the same (reference points to same object) or if one inherits the <br>other. <br></p><p>I thought of using this code for Account : <br></p>
<br>class Account<br>&nbsp; attr_accessor :balance<br>&nbsp; def initialize<br>&nbsp;&nbsp;&nbsp; self.balance = Money.new(0, :dollars)<br>&nbsp; end<br>end<br><br>class Money &lt; Account<br>&nbsp; attr_accessor :amount, :currency<br>&nbsp; def initialize(amount, currency)
<br>&nbsp;&nbsp;&nbsp; @amount = amount<br>&nbsp;&nbsp;&nbsp; @currency = currency<br>&nbsp; end<br>end <br><p> But still can make it work. It does not pass the spec.<br> </p>Thanks ! <br>-- <br>Federico Brubacher<br><a href="http://www.fbrubacher.com">www.fbrubacher.com
</a><br><br>Colonial Duty Free Shop<br><a href="http://www.colonial.com.uy">www.colonial.com.uy</a>