Last active
December 25, 2015 00:29
-
-
Save shepmaster/6888589 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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