Sha256: ca94eac49b0a307edade0626f56c6e84fb063ca15b29b0e1454715c2a42da226

Contents?: true

Size: 1.77 KB

Versions: 5

Compression:

Stored size: 1.77 KB

Contents

require 'test_helper'

class InvoiceBar::AccountsControllerTest < ActionController::TestCase
  setup do
    @routes = InvoiceBar::Engine.routes
    @user = FactoryGirl.create(:invoice_bar_user)
    @account = FactoryGirl.create(:invoice_bar_account, user: @user)

    login_user @user
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:accounts)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create account" do
    @new_account = FactoryGirl.build(:invoice_bar_account, name: 'Account', user: @user)

    assert_difference('InvoiceBar::Account.count') do
      post :create, account: {
        name:                @new_account.name,
        amount:              @new_account.amount,
        bank_account_number: @new_account.bank_account_number,
        iban:                @new_account.iban,
        swift:               @new_account.swift,
        currency_id:         @new_account.currency_id,
        user_id:             @new_account.user_id }
    end
  end

  test "should show account" do
    get :show, id: @account
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @account
    assert_response :success
  end

  test "should update account" do
    put :update, id: @account, account: {
      name:                @account.name,
      amount:              @account.amount,
      bank_account_number: @account.bank_account_number,
      iban:                @account.iban,
      swift:               @account.swift,
      currency_id:         @account.currency_id,
      user_id:             @account.user_id }
  end

  test "should destroy account" do
    assert_difference('InvoiceBar::Account.count', -1) do
      delete :destroy, id: @account
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
invoice_bar-0.0.11 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.10 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.9 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.8 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.7 test/functional/invoice_bar/accounts_controller_test.rb