daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Sep 23rd, 2018 62 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. describe Item
  2.   describe "#received" do
  3.     it "should return the amount of goods received" do
  4.       receiving_records = mock_model(ReceivingRecord)
  5.       subject.stub(:receiving_records) { receiving_records }
  6.       receiving_records.stub(:sum).with(:quantity) { 3 }
  7.       subject.received.should == 3
  8.     end
  9.   end
  10. end
  11.  
  12. class Item < ActiveRecord::Base
  13.   has_many :receiving_records
  14.  
  15.   def received
  16.     receiving_records.sum(:amount)
  17.   end
  18. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top