Skip to content

Instantly share code, notes, and snippets.

View guipdutra's full-sized avatar

Guilherme Dutra guipdutra

View GitHub Profile
require 'controller_helper'
describe BankTransfersController do
let(:descriptor) { Descriptor.make!(:detran_2012) }
let(:tax_revenue) { TaxRevenue.make!(:arrecadacao, :accounting_account => AccountingAccount.make!(:bancos))) }
let(:account_movement) { AccountMovement.make!(:arrecadacao_sem_conta, :bank_account => bank_account, :history => tax_revenue ) }
let(:bank_account) { BankAccount.make!(:itau_tributos_construcao, :account_movements => [ account_movement ]) }
let(:deposit_bank_account) { BankAccount.make!(:santander_folha, :account_movements => [ account_movement ]) }
# encoding: utf-8
require 'spec_helper'
describe MovementsFilter do
let(:descriptor) { Descriptor.make!(:detran_2012) }
let(:management_unit) { ManagementUnit.make!(:unidade_central) }
let(:accounting_account) { AccountingAccount.make!(:with_bank_account, :title => "Credito") }
before do
Timecop.travel(Date.new(2012, 10, 10))
class MovementsFilter
attr_writer :accountancy_movement, :pending_accountancy
def initialize(params = {})
@descriptor = params.fetch(:descriptor) { raise ArgumentError, "You must supply a :descriptor param" }
@month = params[:month] || Date.current.month
@year = params[:year] || Date.current.year
end
def filter()
# encoding: utf-8
require 'request_helper'
feature "BankTransfers", :js => true do
let(:current_descriptor) { Descriptor.make!(:detran_2012) }
let(:current_user) { User.make!(:sobrinho) }
background do
create_roles ['bank_transfers', 'bank_transfer_closings', 'bank_accounts']
sign_in
class CrudController < ApplicationController
before_filter :choose_session_descriptor, :except => [:modal]
before_filter :authorize_resource!
inherit_resources
respond_to :js, :json
has_scope :filter, :type => :hash
has_scope :page, :default => 1, :only => [:index, :modal], :unless => :disable_pagination?
@guipdutra
guipdutra / gist:5656904
Created May 27, 2013 12:49
git add | git status
git add `git ls-files -m|grep extra`
class Entity < Accounting::Model
include CustomData
reload_custom_data
attr_accessible :cnpj, :phone, :image, :email, :fax,
:budget_structure_id, :employee_ids, :tce_organ_type
attr_accessor :employee
mount_uploader :image, ImageUploader
class Entity < Accounting::Model
include CustomData
reload_custom_data
attr_accessible :cnpj, :phone, :image, :email, :fax,
:budget_structure_id, :employee_ids, :tce_organ_type
attr_accessor :employee
mount_uploader :image, ImageUploader
# encoding: utf-8
require "spec_helper"
describe "API::BudgetStructure", :api do
def get_budget_structures(params={})
get api_budget_structures_url, params, { "x-unico-api-customer-secret-token" => "1234" }
end
def get_budget_structure(id)
class AccountingAccount < Accounting::Model
attr_accessible :account_plan_configuration_id, :function,
:title, :nature_balance, :nature_information, :contract_id,
:nature_balance_variation, :bookkeeping, :surplus_indicator,
:movimentation_kind, :debt_type, :detailing_required_thirteenth,
:bank_account_id, :retention_kind, :retention_subtype,
:regulatory_act_id, :parent_id, :child_code
attr_accessor :child_code