Skip to content

Instantly share code, notes, and snippets.

@shepmaster
Last active December 25, 2015 00:29
Show Gist options
  • Save shepmaster/6888589 to your computer and use it in GitHub Desktop.
Save shepmaster/6888589 to your computer and use it in GitHub Desktop.
def new
@transaction_fee = current_company.transaction_fee
@transaction_cost = current_company.transaction_cost
@withdrawal = current_company.withdrawals.new
@available_amount = Withdrawal.available_amount(current_company.id)
@transactions = current_company.transactions.where("payment_status = 'ready_to_pay'")
end
describe 'GET #new' do
let!(:transaction) { FactoryGirl.create(:authorized_transaction_ready_to_pay, company: @user.company) }
let(:withdrawal) { FactoryGirl.create(:withdrawal, company: @user.company, created_by: @user.id) }
before { get :show, {id: withdrawal.id} }
subject(:assigns) { assigns }
# Have to use string keys because of legacy issues, I believe
its("transaction_fee") { should eq 3.59 }
its("transaction_cost") { should eq 0.29 }
its("withdrawal") { should eq withdrawal }
its("available_amount") { should eq 96.12 }
its("transactions") { should match_array([transaction]) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment