Sha256: 1f8d612db0ff5af87178070773147af97fc0db102a20aa48f99e36289b0930be

Contents?: true

Size: 1.94 KB

Versions: 6

Compression:

Stored size: 1.94 KB

Contents

# encoding: utf-8

require 'test_helper'

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

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

  test "should get new" do
    get :new, use_route: :invoice_bar
    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 }, use_route: :invoice_bar
    end
  end

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

  test "should get edit" do
    get :edit, id: @account, use_route: :invoice_bar
    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 }, use_route: :invoice_bar
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
invoice_bar-0.0.6 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.5 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.4 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.3 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.2 test/functional/invoice_bar/accounts_controller_test.rb
invoice_bar-0.0.1 test/functional/invoice_bar/accounts_controller_test.rb