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
before do | |
@user = user_with(first_name: "Maria") | |
@project_one = project_with( | |
fixed_annual_rate: 11, | |
execution_date: Date.new(2015, 10, 8), | |
investments: [investment_with(amount: 100_000, user: user)]) | |
end | |
def project_with(attrs) | |
FakeProject.new({ fixed_annual_rate: 11 }.merge(attrs)) |
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
it "(when project is refunded)" do | |
portfolio = portfolio_on(Date.new(2018, 2, 4)) | |
date = next_payment_date_for_project( | |
portfolio, | |
refunded_project, | |
formatter: ->(date) { "My date: #{date}" }, | |
not_executed_message: "No se ha ejecutado", | |
no_payments_left_message: "No hay más pagos", | |
project_refunded_message: "No aplica" | |
) |
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 Admin::ProjectFundingTerminationsController < Admin::BaseController | |
def destroy | |
Projects.revert_funding_termination( | |
find_project, | |
projects_store: Project, | |
receipts_cancelator: ReceiptsCancelator | |
) | |
redirect_to admin_projects_path | |
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
class Admin::ProjectFundingTerminationsController < Admin::BaseController | |
def new | |
project = find_project | |
form = Projects.terminate_funding_form(project) | |
render locals: { project: project, form: form }, layout: false | |
end | |
def create | |
termination = Projects.terminate_funding( | |
find_project.id, |
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
module Projects | |
def self.publish_project | |
end | |
def self.add_termination_date_form | |
end | |
def self.add_termination_date | |
end | |
def self.details_page_for_project | |
end | |
def self.terminate_funding_form |
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 User < ActiveRecord::Base | |
def self.last_registered(number) | |
order(id: :desc).limit(number) | |
end | |
end | |
class Admin::UsersExportsController < Admin::BaseController | |
def create | |
export = Users.export_users(User, params[:users_export], Date.current) | |
# other stuff... |
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
require 'json' | |
require 'yaml' | |
all = [{:id=>1, :label=>"floral", :color=>"#F5F058", :parent_id=>nil, :label_es=>"floral", :open=>1, :zoomed=>1, :selected=>1, :flavor_type=>"flavor", :positive=>1}, {:id=>2, :label=>"fruit", :color=>"#AA274E", :parent_id=>nil, :label_es=>"frutal", :open=>1, :zoomed=>1, :selected=>1, :flavor_type=>"flavor", :positive=>1}, {:id=>3, :label=>"chocolate", :color=>"#6F5740", :parent_id=>nil, :label_es=>"chocolate", :open=>1, :zoomed=>1, :selected=>1, :flavor_type=>"flavor", :positive=>1}, {:id=>4, :label=>"sweet", :color=>"#FAF8A9", :parent_id=>nil, :label_es=>"dulce", :open=>1, :zoomed=>1, :selected=>1, :flavor_type=>"flavor", :positive=>1}, {:id=>5, :label=>"nut", :color=>"#F38546", :parent_id=>nil, :label_es=>"nuez", :open=>1, :zoomed=>1, :selected=>1, :flavor_type=>"flavor", :positive=>1}, {:id=>6, :label=>"grain/cereal", :color=>"#AB9566", :parent_id=>nil, :label_es=>"granos/cereal", :open=>1, :zoomed=>1, :selected=>1, :flavor_type=>"flavor", :positive=>1}, {:id=>7, :label=>"roa |