This file contains hidden or 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
| scenario "updating email", js: true, focus: true do | |
| person = create(:person) | |
| login_as create(:user, role: "Operacional") | |
| visit "/people" | |
| find(:xpath, '//*[@id="body"]/table/tbody/tr[1]/td[6]/a[2]').click | |
| within "#edit_email" do | |
| fill_in "Email", with: "[email protected]" | |
| click_on "Salvar" |
This file contains hidden or 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
| scenario "upload with errors", js: true do | |
| filepath = "#{Rails.root}/spec/fixtures/transactions_with_errors.xls" | |
| puts File.exists?(filepath) #true | |
| attach_file "transactions_spreadsheet", filepath | |
| click_on "Enviar" | |
| save_and_open_page | |
| end |
This file contains hidden or 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
| # encoding: utf-8 | |
| require 'spec_helper' | |
| feature "accounts" do | |
| given(:person) { create(:person).decorate } | |
| background { login_as(person.user) } | |
| scenario "creating individual account" do | |
| visit "/accounts/new" |
This file contains hidden or 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 mail | |
| if !activity_type.public || activity_type.private_fields.count > 0 | |
| ActivityMailer.delay.report(id, true) | |
| end | |
| if activity_type.public | |
| public_fields = self.values.select { |value| value.field.public && !value.blank? } | |
| ActivityMailer.delay.report(id, false) unless public_fields.empty? | |
| end | |
| end |
This file contains hidden or 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
| config.before(:all) do | |
| ActiveRecord::Schema.verbose = false | |
| load_schema = lambda { | |
| load "#{Rails.root.to_s}/db/schema.rb" | |
| # ActiveRecord::Migrator.up('db/migrate') # use migrations | |
| } | |
| silence_stream(STDOUT, &load_schema) | |
| end |
This file contains hidden or 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
| test: &test | |
| adapter: sqlite3 | |
| encoding: utf8 | |
| database: ":memory:" |
This file contains hidden or 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
| class MoveFundGroupFromFundsToCrawlers < ActiveRecord::Migration | |
| def change | |
| add_column :crawlers, :fund_group, :integer | |
| Fund.all.each do |fund| | |
| fund.crawler.update_attributes(:fund_group => fund.fund_group) if fund.fund_group && !fund.crawler.nil? | |
| end | |
| remove_column :funds, :fund_group | |
| end | |
| end |
This file contains hidden or 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
| if activity.activitable.is_a? Account | |
| restricted_mail = ["[email protected]"] | |
| alias :reporter :account_report | |
| elsif activity.activitable.is_a? Manager | |
| restricted_mail = ["[email protected]"] | |
| alias :reporter :manager_report | |
| end | |
| reporter(activity, to, false) |
This file contains hidden or 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 report(activity) | |
| if activity.activitable.is_a? Account | |
| account_report(activity) | |
| elsif activity.activitable.is_a? Manager | |
| manager_report(activity) | |
| end | |
| end |
This file contains hidden or 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
| oldest = {} | |
| transactions.each do |transaction| | |
| oldest[transaction.account_id] ||= {} | |
| oldest[transaction.account_id][transaction.fund_id] ||= transaction | |
| if transaction.value_date < oldest[transaction.account_id][transaction.fund_id].value_date | |
| oldest[transaction.account_id][transaction.fund_id] = transaction | |
| end | |
| transaction.save | |
| end |