Guest User

Untitled

a guest
Jul 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.62 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe WithdrawTransactionsController do
  4.   login_user
  5.   let(:user) { Factory.stub :user }
  6.   let(:transaction_attrs) { {'amount' => '199.99'} }
  7.   let(:withdraw_transaction) { Factory.stub :withdraw_transaction }
  8.  
  9.   describe "POST 'create'" do
  10.     before(:each) do
  11.       controller.stubs(:current_user).returns(user)
  12.     end
  13.    
  14.     it "should create WithdrawTransaction" do
  15.       WithdrawTransaction.expects(:new).with(transaction_attrs).returns(withdraw_transaction)
  16.       do_post
  17.     end
  18.    
  19.     def do_post
  20.       post 'create', withdraw_transaction: transaction_attrs
  21.     end
  22.   end
  23. end
Add Comment
Please, Sign In to add comment