dorsale 3.20.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -3
- data/app/controllers/dorsale/alexandrie/attachments_controller.rb +1 -1
- data/app/controllers/dorsale/application_controller.rb +1 -1
- data/app/controllers/dorsale/billing_machine/application_controller.rb +2 -2
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +1 -1
- data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +1 -1
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +1 -1
- data/app/controllers/dorsale/comments_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/activity_types_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/application_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/events_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/links_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/origins_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/people_controller.rb +1 -1
- data/app/controllers/dorsale/expense_gun/application_controller.rb +1 -1
- data/app/controllers/dorsale/expense_gun/categories_controller.rb +1 -1
- data/app/controllers/dorsale/flyboy/application_controller.rb +1 -1
- data/app/controllers/dorsale/flyboy/task_comments_controller.rb +1 -1
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +1 -1
- data/app/controllers/dorsale/users_controller.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_for_invoices.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_for_quotations.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_customer.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb +1 -1
- data/app/filters/dorsale/customer_vault/small_data/filter_for_events.rb +1 -1
- data/app/filters/dorsale/customer_vault/small_data/filter_for_people.rb +1 -1
- data/app/filters/dorsale/customer_vault/small_data/filter_strategy_by_activity_type.rb +1 -1
- data/app/filters/dorsale/expense_gun/small_data/filter_for_expenses.rb +1 -1
- data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
- data/app/filters/dorsale/flyboy/small_data/filter_strategy_by_task_state.rb +2 -2
- data/app/helpers/dorsale/alexandrie/attachments_helper.rb +1 -1
- data/app/helpers/dorsale/comments_helper.rb +2 -2
- data/app/helpers/dorsale/customer_vault/application_helper.rb +1 -1
- data/app/helpers/dorsale/flyboy/application_helper.rb +2 -2
- data/app/mailers/dorsale/application_mailer.rb +1 -1
- data/app/mailers/dorsale/flyboy/task_mailer.rb +1 -1
- data/app/mailers/dorsale/user_mailer.rb +1 -1
- data/app/models/dorsale/address.rb +3 -3
- data/app/models/dorsale/alexandrie/attachment.rb +1 -1
- data/app/models/dorsale/alexandrie/attachment_type.rb +1 -1
- data/app/models/dorsale/billing_machine/invoice.rb +1 -1
- data/app/models/dorsale/billing_machine/invoice_line.rb +1 -1
- data/app/models/dorsale/billing_machine/payment_term.rb +1 -1
- data/app/models/dorsale/billing_machine/quotation.rb +8 -8
- data/app/models/dorsale/billing_machine/quotation_line.rb +1 -1
- data/app/models/dorsale/comment.rb +1 -1
- data/app/models/dorsale/customer_vault/activity_type.rb +1 -1
- data/app/models/dorsale/customer_vault/corporation.rb +2 -2
- data/app/models/dorsale/customer_vault/event.rb +3 -3
- data/app/models/dorsale/customer_vault/individual.rb +2 -2
- data/app/models/dorsale/customer_vault/link.rb +1 -1
- data/app/models/dorsale/customer_vault/origin.rb +1 -1
- data/app/models/dorsale/customer_vault/person.rb +6 -6
- data/app/models/dorsale/expense_gun/category.rb +1 -1
- data/app/models/dorsale/expense_gun/expense.rb +2 -2
- data/app/models/dorsale/expense_gun/expense_line.rb +1 -1
- data/app/models/dorsale/flyboy/task.rb +5 -5
- data/app/models/dorsale/flyboy/task_comment.rb +1 -1
- data/app/pdfs/dorsale/application_pdf.rb +1 -1
- data/app/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf.rb +19 -17
- data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +30 -28
- data/app/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf.rb +1 -1
- data/app/pdfs/dorsale/billing_machine/quotation_single_vat_pdf.rb +1 -1
- data/app/pdfs/dorsale/expense_gun/expense_pdf.rb +2 -2
- data/app/pdfs/dorsale/prawn_helpers.rb +2 -2
- data/app/policies/dorsale/application_policy.rb +1 -1
- data/app/services/dorsale/billing_machine/invoice/copy.rb +1 -1
- data/app/services/dorsale/billing_machine/invoice/statistics.rb +5 -5
- data/app/services/dorsale/billing_machine/quotation/copy.rb +1 -1
- data/app/services/dorsale/billing_machine/quotation/statistics.rb +5 -5
- data/app/services/dorsale/billing_machine/quotation/to_invoice.rb +5 -5
- data/app/services/dorsale/expense_gun/expense/copy.rb +1 -1
- data/app/services/dorsale/flyboy/task/copy.rb +1 -1
- data/app/services/dorsale/flyboy/task/snoozer.rb +1 -1
- data/app/services/dorsale/service.rb +2 -2
- data/app/services/dorsale/tag_list_for_model.rb +1 -1
- data/app/uploaders/dorsale/alexandrie/file_uploader.rb +1 -1
- data/app/uploaders/dorsale/application_uploader.rb +1 -1
- data/app/uploaders/dorsale/avatar_uploader.rb +1 -1
- data/app/uploaders/dorsale/image_uploader.rb +2 -2
- data/app/uploaders/dorsale/pdf_uploader.rb +2 -2
- data/app/views/dorsale/customer_vault/people/index.xlsx.ruby +3 -3
- data/features/step_definitions/billing_machine_invoices_steps.rb +4 -4
- data/features/step_definitions/billing_machine_multiple_vat.rb +1 -1
- data/features/step_definitions/billing_machine_quotations_steps.rb +2 -2
- data/features/step_definitions/customer_vault_corporations_steps.rb +4 -4
- data/features/step_definitions/customer_vault_people_steps.rb +1 -1
- data/features/step_definitions/customer_vault_tasks_steps.rb +3 -3
- data/features/step_definitions/flyboy_tasks_steps.rb +1 -1
- data/lib/dorsale/engine.rb +11 -5
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +3 -3
- data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +5 -5
- data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +2 -2
- data/spec/factories/alexandrie_attachment_types.rb +1 -1
- data/spec/factories/alexandrie_attachments.rb +1 -1
- data/spec/factories/billing_machine_invoice_lines.rb +1 -1
- data/spec/factories/billing_machine_invoices.rb +1 -1
- data/spec/factories/billing_machine_payment_terms.rb +1 -1
- data/spec/factories/billing_machine_quotation_lines.rb +1 -1
- data/spec/factories/billing_machine_quotations.rb +1 -1
- data/spec/factories/customer_vault_activity_types.rb +1 -1
- data/spec/factories/customer_vault_corporations.rb +1 -1
- data/spec/factories/customer_vault_event.rb +1 -1
- data/spec/factories/customer_vault_individuals.rb +2 -2
- data/spec/factories/customer_vault_links.rb +1 -1
- data/spec/factories/customer_vault_origins.rb +1 -1
- data/spec/factories/dorsale_addresses.rb +1 -1
- data/spec/factories/dorsale_comments.rb +1 -1
- data/spec/factories/expense_gun_categories.rb +1 -1
- data/spec/factories/expense_gun_expense_lines.rb +1 -1
- data/spec/factories/expense_gun_expenses.rb +2 -2
- data/spec/factories/flyboy_task_comments.rb +1 -1
- data/spec/factories/flyboy_tasks.rb +1 -1
- data/spec/mailers/user_mailer_spec.rb +2 -2
- data/spec/models/dorsale/alexandrie/attachment_spec.rb +1 -1
- data/spec/models/dorsale/alexandrie/attachment_type_spec.rb +1 -1
- data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +5 -5
- data/spec/models/dorsale/billing_machine/invoice_spec.rb +10 -10
- data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +6 -6
- data/spec/models/dorsale/billing_machine/quotation_spec.rb +8 -8
- data/spec/models/dorsale/billing_machine_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/activity_type_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/corporation_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/event_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/individual_spec.rb +3 -3
- data/spec/models/dorsale/customer_vault/link_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/origin_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/person_spec.rb +2 -2
- data/spec/models/dorsale/expense_gun/category_spec.rb +1 -1
- data/spec/models/dorsale/expense_gun/expense_line_spec.rb +2 -2
- data/spec/models/dorsale/flyboy/task_comment_spec.rb +5 -5
- data/spec/models/dorsale/flyboy/task_spec.rb +7 -7
- data/spec/models/dorsale/i18n_spec.rb +1 -1
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +3 -3
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +3 -3
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +3 -3
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +3 -3
- data/spec/rails_helper.rb +0 -3
- data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +2 -2
- data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/activity_types_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/events_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/origins_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +2 -2
- data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +2 -2
- data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +2 -2
- data/spec/routing/dorsale/flyboy/tasks_routing_spec.rb +2 -2
- data/spec/routing/dorsale/users_routing_spec.rb +2 -2
- data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +2 -2
- metadata +111 -114
data/lib/dorsale/engine.rb
CHANGED
|
@@ -23,7 +23,7 @@ require "axlsx"
|
|
|
23
23
|
|
|
24
24
|
require "agilibox"
|
|
25
25
|
|
|
26
|
-
if Rails.env.
|
|
26
|
+
if Rails.env.local?
|
|
27
27
|
require "pry"
|
|
28
28
|
require "factory_bot_rails"
|
|
29
29
|
require "factory_bot"
|
|
@@ -35,8 +35,14 @@ module Dorsale
|
|
|
35
35
|
class Engine < ::Rails::Engine
|
|
36
36
|
isolate_namespace Dorsale
|
|
37
37
|
|
|
38
|
+
initializer "inflections" do
|
|
39
|
+
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
40
|
+
inflect.acronym "DH"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
38
44
|
initializer "factory_bot" do
|
|
39
|
-
if Rails.env.
|
|
45
|
+
if Rails.env.local?
|
|
40
46
|
FactoryBot.definition_file_paths.unshift Dorsale::Engine.root.join("spec/factories/").to_s
|
|
41
47
|
end
|
|
42
48
|
end
|
|
@@ -48,13 +54,13 @@ module Dorsale
|
|
|
48
54
|
end
|
|
49
55
|
|
|
50
56
|
config.after_initialize do
|
|
51
|
-
Dorsale::PolicyChecker.check! if Rails.env.
|
|
57
|
+
Dorsale::PolicyChecker.check! if Rails.env.local?
|
|
52
58
|
end
|
|
53
59
|
|
|
54
60
|
initializer "assets" do
|
|
55
|
-
Rails.application.config.assets.precompile += %w
|
|
61
|
+
Rails.application.config.assets.precompile += %w[
|
|
56
62
|
dorsale/avatar.png
|
|
57
|
-
|
|
63
|
+
]
|
|
58
64
|
end
|
|
59
65
|
|
|
60
66
|
initializer "simple_form" do
|
data/lib/dorsale/version.rb
CHANGED
|
@@ -133,7 +133,7 @@ describe Dorsale::Alexandrie::AttachmentsController, type: :controller do
|
|
|
133
133
|
it "should delete attachment" do
|
|
134
134
|
expect {
|
|
135
135
|
delete :destroy, params: {id: attachment}
|
|
136
|
-
}.to change(
|
|
136
|
+
}.to change(Dorsale::Alexandrie::Attachment, :count).by(-1)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
it "should render list" do
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
3
|
+
RSpec.describe Dorsale::CustomerVault::PeopleController, type: :controller do
|
|
4
4
|
routes { Dorsale::Engine.routes }
|
|
5
5
|
|
|
6
6
|
let(:user) { create(:user) }
|
|
@@ -57,7 +57,7 @@ RSpec.describe ::Dorsale::CustomerVault::PeopleController, type: :controller do
|
|
|
57
57
|
|
|
58
58
|
it "should filter by person origin" do
|
|
59
59
|
origin = create(:customer_vault_origin)
|
|
60
|
-
individual1 = create(:customer_vault_individual, origin:
|
|
60
|
+
individual1 = create(:customer_vault_individual, origin:)
|
|
61
61
|
individual2 = create(:customer_vault_individual)
|
|
62
62
|
|
|
63
63
|
cookies[:filters] = {person_origin: origin.id}.to_json
|
|
@@ -68,7 +68,7 @@ RSpec.describe ::Dorsale::CustomerVault::PeopleController, type: :controller do
|
|
|
68
68
|
|
|
69
69
|
it "should filter by person activity_type" do
|
|
70
70
|
activity_type = create(:customer_vault_activity_type)
|
|
71
|
-
corporation1 = create(:customer_vault_corporation, activity_type:
|
|
71
|
+
corporation1 = create(:customer_vault_corporation, activity_type:)
|
|
72
72
|
corporation2 = create(:customer_vault_corporation)
|
|
73
73
|
|
|
74
74
|
cookies[:filters] = {person_activity: activity_type.id}.to_json
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
3
|
+
RSpec.describe Dorsale::ExpenseGun::ExpensesController, type: :controller do
|
|
4
4
|
routes { Dorsale::Engine.routes }
|
|
5
5
|
let(:user) { create(:user) }
|
|
6
6
|
before(:each) { sign_in(user) }
|
|
@@ -66,7 +66,7 @@ RSpec.describe ::Dorsale::ExpenseGun::ExpensesController, type: :controller do
|
|
|
66
66
|
render_views
|
|
67
67
|
|
|
68
68
|
it "should be ok as PDF" do
|
|
69
|
-
expense = create(:expense_gun_expense, user:
|
|
69
|
+
expense = create(:expense_gun_expense, user:)
|
|
70
70
|
get :show, params: {id: expense, format: :pdf}
|
|
71
71
|
expect(response).to be_ok
|
|
72
72
|
end
|
|
@@ -74,7 +74,7 @@ RSpec.describe ::Dorsale::ExpenseGun::ExpensesController, type: :controller do
|
|
|
74
74
|
|
|
75
75
|
describe "#go_to_pending" do
|
|
76
76
|
it "should go to pending and redirect" do
|
|
77
|
-
expense = create(:expense_gun_expense, user
|
|
77
|
+
expense = create(:expense_gun_expense, user:, state: "draft")
|
|
78
78
|
post :go_to_pending, params: {id: expense}
|
|
79
79
|
expect(response).to be_redirect
|
|
80
80
|
expect(flash.notice).to be_present
|
|
@@ -84,7 +84,7 @@ RSpec.describe ::Dorsale::ExpenseGun::ExpensesController, type: :controller do
|
|
|
84
84
|
|
|
85
85
|
describe "#go_to_paid" do
|
|
86
86
|
it "should go to paid and redirect" do
|
|
87
|
-
expense = create(:expense_gun_expense, user
|
|
87
|
+
expense = create(:expense_gun_expense, user:, state: "pending")
|
|
88
88
|
post :go_to_paid, params: {id: expense}
|
|
89
89
|
expect(response).to be_redirect
|
|
90
90
|
expect(flash.notice).to be_present
|
|
@@ -94,7 +94,7 @@ RSpec.describe ::Dorsale::ExpenseGun::ExpensesController, type: :controller do
|
|
|
94
94
|
|
|
95
95
|
describe "#go_to_canceled" do
|
|
96
96
|
it "should go to canceled and redirect" do
|
|
97
|
-
expense = create(:expense_gun_expense, user
|
|
97
|
+
expense = create(:expense_gun_expense, user:, state: "draft")
|
|
98
98
|
post :go_to_canceled, params: {id: expense}
|
|
99
99
|
expect(response).to be_redirect
|
|
100
100
|
expect(flash.notice).to be_present
|
|
@@ -8,7 +8,7 @@ describe Dorsale::Flyboy::TaskCommentsController, type: :controller do
|
|
|
8
8
|
before(:each) { sign_in(user) }
|
|
9
9
|
|
|
10
10
|
let(:task) { create(:flyboy_task) }
|
|
11
|
-
let(:task_comment) { create(:flyboy_task_comment, task:
|
|
11
|
+
let(:task_comment) { create(:flyboy_task_comment, task:) }
|
|
12
12
|
|
|
13
13
|
describe "#create" do
|
|
14
14
|
let(:valid_params) { {task_id: task.id, task_comment: task_comment.attributes} }
|
|
@@ -20,7 +20,7 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
|
|
|
20
20
|
|
|
21
21
|
describe "#complete" do
|
|
22
22
|
before(:each) do
|
|
23
|
-
request.env["HTTP_REFERER"] = "where_i_came_from"
|
|
23
|
+
request.env["HTTP_REFERER"] = "/where_i_came_from"
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it "should mark the task as done" do
|
|
@@ -42,7 +42,7 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
|
|
|
42
42
|
|
|
43
43
|
it "should redirect to the referer page" do
|
|
44
44
|
patch :complete, params: {id: task.id}
|
|
45
|
-
expect(response).to redirect_to "where_i_came_from"
|
|
45
|
+
expect(response).to redirect_to "/where_i_came_from"
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :billing_machine_invoice_line, class:
|
|
2
|
+
factory :billing_machine_invoice_line, class: Dorsale::BillingMachine::InvoiceLine do
|
|
3
3
|
invoice { create(:billing_machine_invoice) }
|
|
4
4
|
label { "Invoice line" + Faker::Lorem.words.join(" ") }
|
|
5
5
|
quantity { 10 }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :billing_machine_invoice, class:
|
|
2
|
+
factory :billing_machine_invoice, class: Dorsale::BillingMachine::Invoice do
|
|
3
3
|
customer { create(:customer_vault_corporation) }
|
|
4
4
|
payment_term { create(:billing_machine_payment_term) }
|
|
5
5
|
date { "2014-02-19" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :billing_machine_quotation_line, class:
|
|
2
|
+
factory :billing_machine_quotation_line, class: Dorsale::BillingMachine::QuotationLine do
|
|
3
3
|
quotation { create(:billing_machine_quotation) }
|
|
4
4
|
label { "Quotation line" + Faker::Lorem.words.join(" ") }
|
|
5
5
|
quantity { 10 }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :billing_machine_quotation, class:
|
|
2
|
+
factory :billing_machine_quotation, class: Dorsale::BillingMachine::Quotation do
|
|
3
3
|
customer { create(:customer_vault_corporation) }
|
|
4
4
|
payment_term { create(:billing_machine_payment_term) }
|
|
5
5
|
date { "2014-02-19" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :customer_vault_corporation, class:
|
|
2
|
+
factory :customer_vault_corporation, class: Dorsale::CustomerVault::Corporation do
|
|
3
3
|
activity_type { create(:customer_vault_activity_type) }
|
|
4
4
|
origin { create(:customer_vault_origin) }
|
|
5
5
|
name { "#{Faker::Company.name} #{Faker::Company.suffix}" }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :customer_vault_individual, class:
|
|
2
|
+
factory :customer_vault_individual, class: Dorsale::CustomerVault::Individual do
|
|
3
3
|
origin { create(:customer_vault_origin) }
|
|
4
4
|
first_name { Faker::Name.first_name }
|
|
5
5
|
last_name { Faker::Name.last_name }
|
|
6
6
|
short_name { "SN" }
|
|
7
|
-
email { Faker::Internet.email(name:
|
|
7
|
+
email { Faker::Internet.email(name:) }
|
|
8
8
|
title { "Individual-Title" }
|
|
9
9
|
twitter { "#{first_name}#{last_name}" }
|
|
10
10
|
www { Faker::Internet.url }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :customer_vault_link, class:
|
|
2
|
+
factory :customer_vault_link, class: Dorsale::CustomerVault::Link do
|
|
3
3
|
association :alice, factory: :customer_vault_individual
|
|
4
4
|
association :bob, factory: :customer_vault_corporation
|
|
5
5
|
title { "Manager" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :expense_gun_category, class:
|
|
2
|
+
factory :expense_gun_category, class: Dorsale::ExpenseGun::Category do
|
|
3
3
|
name { Faker::Lorem.word }
|
|
4
4
|
code { Faker::Number.number(digits: 4) }
|
|
5
5
|
vat_deductible { [true, false].sample }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :expense_gun_expense_line, class:
|
|
2
|
+
factory :expense_gun_expense_line, class: Dorsale::ExpenseGun::ExpenseLine do
|
|
3
3
|
expense { build(:expense_gun_expense) }
|
|
4
4
|
name { Faker::Lorem.sentence(word_count: 3) }
|
|
5
5
|
category { build(:expense_gun_category) }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :expense_gun_expense, class:
|
|
2
|
+
factory :expense_gun_expense, class: Dorsale::ExpenseGun::Expense do
|
|
3
3
|
name { Faker::Lorem.sentence(word_count: 3) }
|
|
4
4
|
date { Date.current }
|
|
5
5
|
user { create(:user) }
|
|
6
6
|
|
|
7
7
|
after(:create) { |expense|
|
|
8
8
|
rand(2..5).times {
|
|
9
|
-
create(:expense_gun_expense_line, expense:
|
|
9
|
+
create(:expense_gun_expense_line, expense:)
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
factory :flyboy_task, class:
|
|
2
|
+
factory :flyboy_task, class: Dorsale::Flyboy::Task do
|
|
3
3
|
name { "I-am-a-task#{Kernel.rand(1_000..9_999)}" }
|
|
4
4
|
description { "I-am-the-task-description_#{Kernel.rand(1_000..9_999)}" }
|
|
5
5
|
progress { Kernel.rand(0..99) }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Dorsale::UserMailer do
|
|
4
4
|
describe "New Account" do
|
|
5
5
|
let(:user) { create(:user) }
|
|
6
|
-
let(:email) {
|
|
6
|
+
let(:email) { Dorsale::UserMailer.new_account(user, user.password) }
|
|
7
7
|
|
|
8
8
|
it "should send to the right person" do
|
|
9
9
|
expect(email.to).to eq([user.email])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Dorsale::Alexandrie::Attachment, type: :model do
|
|
4
4
|
it { is_expected.to belong_to :attachable }
|
|
5
5
|
it { is_expected.to belong_to :sender }
|
|
6
6
|
it { is_expected.to belong_to :attachment_type }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Dorsale::Alexandrie::AttachmentType, type: :model do
|
|
4
4
|
it { is_expected.to have_many(:attachments).dependent(:nullify) }
|
|
5
5
|
|
|
6
6
|
it { is_expected.to validate_presence_of :name }
|
|
@@ -30,11 +30,11 @@ describe Dorsale::BillingMachine::InvoiceLine, type: :model do
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it "should be sorted by created_at" do
|
|
33
|
-
line1 = create(:billing_machine_invoice_line, :created_at =>
|
|
34
|
-
line2 = create(:billing_machine_invoice_line, :created_at =>
|
|
35
|
-
line3 = create(:billing_machine_invoice_line, :created_at =>
|
|
36
|
-
line4 = create(:billing_machine_invoice_line, :created_at =>
|
|
37
|
-
line3.update!(:created_at =>
|
|
33
|
+
line1 = create(:billing_machine_invoice_line, :created_at => 1.minute.from_now)
|
|
34
|
+
line2 = create(:billing_machine_invoice_line, :created_at => 2.minutes.from_now)
|
|
35
|
+
line3 = create(:billing_machine_invoice_line, :created_at => 3.minutes.from_now)
|
|
36
|
+
line4 = create(:billing_machine_invoice_line, :created_at => 4.minutes.from_now)
|
|
37
|
+
line3.update!(:created_at => 5.minutes.from_now)
|
|
38
38
|
|
|
39
39
|
lines = described_class.all
|
|
40
40
|
expect(lines).to eq [line1, line2, line4, line3]
|
|
@@ -3,7 +3,7 @@ require "rails_helper"
|
|
|
3
3
|
describe Dorsale::BillingMachine::Invoice, type: :model do
|
|
4
4
|
# Reset to default mode before each test
|
|
5
5
|
before :each do
|
|
6
|
-
|
|
6
|
+
Dorsale::BillingMachine.vat_mode = :single
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it { is_expected.to belong_to :customer }
|
|
@@ -105,8 +105,8 @@ describe Dorsale::BillingMachine::Invoice, type: :model do
|
|
|
105
105
|
|
|
106
106
|
it "should work fine upon creation" do
|
|
107
107
|
invoice = build(:billing_machine_invoice)
|
|
108
|
-
invoice.lines <<
|
|
109
|
-
invoice.lines <<
|
|
108
|
+
invoice.lines << Dorsale::BillingMachine::InvoiceLine.new(quantity: 1, unit_price: 10)
|
|
109
|
+
invoice.lines << Dorsale::BillingMachine::InvoiceLine.new(quantity: 1, unit_price: 10)
|
|
110
110
|
invoice.save!
|
|
111
111
|
end
|
|
112
112
|
end
|
|
@@ -120,7 +120,7 @@ describe Dorsale::BillingMachine::Invoice, type: :model do
|
|
|
120
120
|
|
|
121
121
|
describe "vat rate" do
|
|
122
122
|
it "default vat rate should be 20" do
|
|
123
|
-
expect(described_class.new.vat_rate).to eq
|
|
123
|
+
expect(described_class.new.vat_rate).to eq Dorsale::BillingMachine.default_vat_rate
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
it "it should be specified vat rate" do
|
|
@@ -129,22 +129,22 @@ describe Dorsale::BillingMachine::Invoice, type: :model do
|
|
|
129
129
|
|
|
130
130
|
it "it should be first line vat rate" do
|
|
131
131
|
invoice = create(:billing_machine_invoice)
|
|
132
|
-
line1 = create(:billing_machine_invoice_line, invoice
|
|
133
|
-
line2 = create(:billing_machine_invoice_line, invoice
|
|
132
|
+
line1 = create(:billing_machine_invoice_line, invoice:, vat_rate: 10)
|
|
133
|
+
line2 = create(:billing_machine_invoice_line, invoice:, vat_rate: 10)
|
|
134
134
|
expect(invoice.vat_rate).to eq 10
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
it "it should raise if multiple vat_rates" do
|
|
138
138
|
invoice = create(:billing_machine_invoice)
|
|
139
|
-
line1 = create(:billing_machine_invoice_line, invoice
|
|
139
|
+
line1 = create(:billing_machine_invoice_line, invoice:, vat_rate: 10)
|
|
140
140
|
|
|
141
141
|
expect {
|
|
142
|
-
line2 = create(:billing_machine_invoice_line, invoice
|
|
142
|
+
line2 = create(:billing_machine_invoice_line, invoice:, vat_rate: 15)
|
|
143
143
|
}.to raise_error(RuntimeError)
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
it "it should raise when vat mode is multiple" do
|
|
147
|
-
|
|
147
|
+
Dorsale::BillingMachine.vat_mode = :multiple
|
|
148
148
|
invoice = build(:billing_machine_invoice)
|
|
149
149
|
expect { invoice.vat_rate }.to raise_error(RuntimeError)
|
|
150
150
|
end
|
|
@@ -247,7 +247,7 @@ describe Dorsale::BillingMachine::Invoice, type: :model do
|
|
|
247
247
|
it "should work fine even with empty lines" do
|
|
248
248
|
invoice = create(:billing_machine_invoice)
|
|
249
249
|
|
|
250
|
-
create(:billing_machine_invoice_line, invoice
|
|
250
|
+
create(:billing_machine_invoice_line, invoice:, quantity: nil, unit_price: nil)
|
|
251
251
|
|
|
252
252
|
expect(invoice.total_excluding_taxes).to eq(0.0)
|
|
253
253
|
expect(invoice.vat_amount).to eq(0)
|
|
@@ -25,16 +25,16 @@ describe Dorsale::BillingMachine::QuotationLine do
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it "vat_rate should be 0" do
|
|
28
|
-
expect(described_class.new.vat_rate).to eq
|
|
28
|
+
expect(described_class.new.vat_rate).to eq Dorsale::BillingMachine.default_vat_rate
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it "should be sorted by created_at" do
|
|
33
|
-
line1 = create(:billing_machine_quotation_line, :created_at =>
|
|
34
|
-
line2 = create(:billing_machine_quotation_line, :created_at =>
|
|
35
|
-
line3 = create(:billing_machine_quotation_line, :created_at =>
|
|
36
|
-
line4 = create(:billing_machine_quotation_line, :created_at =>
|
|
37
|
-
line3.update!(:created_at =>
|
|
33
|
+
line1 = create(:billing_machine_quotation_line, :created_at => 1.minute.from_now)
|
|
34
|
+
line2 = create(:billing_machine_quotation_line, :created_at => 2.minutes.from_now)
|
|
35
|
+
line3 = create(:billing_machine_quotation_line, :created_at => 3.minutes.from_now)
|
|
36
|
+
line4 = create(:billing_machine_quotation_line, :created_at => 4.minutes.from_now)
|
|
37
|
+
line3.update!(:created_at => 5.minutes.from_now)
|
|
38
38
|
lines = described_class.all
|
|
39
39
|
expect(lines).to eq [line1, line2, line4, line3]
|
|
40
40
|
end
|
|
@@ -42,8 +42,8 @@ describe Dorsale::BillingMachine::Quotation do
|
|
|
42
42
|
|
|
43
43
|
it "should work fine upon creation" do
|
|
44
44
|
quotation = build(:billing_machine_quotation)
|
|
45
|
-
quotation.lines <<
|
|
46
|
-
quotation.lines <<
|
|
45
|
+
quotation.lines << Dorsale::BillingMachine::QuotationLine.new(quantity: 1, unit_price: 10)
|
|
46
|
+
quotation.lines << Dorsale::BillingMachine::QuotationLine.new(quantity: 1, unit_price: 10)
|
|
47
47
|
quotation.save!
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -74,7 +74,7 @@ describe Dorsale::BillingMachine::Quotation do
|
|
|
74
74
|
|
|
75
75
|
describe "vat rate" do
|
|
76
76
|
it "default vat rate should be 20" do
|
|
77
|
-
expect(described_class.new.vat_rate).to eq
|
|
77
|
+
expect(described_class.new.vat_rate).to eq Dorsale::BillingMachine.default_vat_rate
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it "it should be specified vat rate" do
|
|
@@ -83,22 +83,22 @@ describe Dorsale::BillingMachine::Quotation do
|
|
|
83
83
|
|
|
84
84
|
it "it should be first line vat rate" do
|
|
85
85
|
quotation = create(:billing_machine_quotation)
|
|
86
|
-
line1 = create(:billing_machine_quotation_line, quotation
|
|
87
|
-
line2 = create(:billing_machine_quotation_line, quotation
|
|
86
|
+
line1 = create(:billing_machine_quotation_line, quotation:, vat_rate: 10)
|
|
87
|
+
line2 = create(:billing_machine_quotation_line, quotation:, vat_rate: 10)
|
|
88
88
|
expect(quotation.vat_rate).to eq 10
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
it "it should raise if multiple vat_rates" do
|
|
92
92
|
quotation = create(:billing_machine_quotation)
|
|
93
|
-
line1 = create(:billing_machine_quotation_line, quotation
|
|
93
|
+
line1 = create(:billing_machine_quotation_line, quotation:, vat_rate: 10)
|
|
94
94
|
|
|
95
95
|
expect {
|
|
96
|
-
line2 = create(:billing_machine_quotation_line, quotation
|
|
96
|
+
line2 = create(:billing_machine_quotation_line, quotation:, vat_rate: 15)
|
|
97
97
|
}.to raise_error(RuntimeError)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
it "it should raise when vat mode is multiple" do
|
|
101
|
-
|
|
101
|
+
Dorsale::BillingMachine.vat_mode = :multiple
|
|
102
102
|
quotation = build(:billing_machine_quotation)
|
|
103
103
|
expect { quotation.vat_rate }.to raise_error(RuntimeError)
|
|
104
104
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
3
|
+
RSpec.describe Dorsale::CustomerVault::Corporation, type: :model do
|
|
4
4
|
it { is_expected.to have_one(:address).dependent(:destroy) }
|
|
5
5
|
it { is_expected.to have_many :comments }
|
|
6
6
|
it { is_expected.to have_many :taggings }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
3
|
+
RSpec.describe Dorsale::CustomerVault::Individual, :type => :model do
|
|
4
4
|
it "should have a valid factory" do
|
|
5
5
|
individual = create(:customer_vault_individual)
|
|
6
6
|
expect(individual).to be_valid
|
|
@@ -26,7 +26,7 @@ RSpec.describe ::Dorsale::CustomerVault::Individual, :type => :model do
|
|
|
26
26
|
describe "activity type" do
|
|
27
27
|
it "should have the same activity than his corporation" do
|
|
28
28
|
corporation = create(:customer_vault_corporation)
|
|
29
|
-
individual = create(:customer_vault_individual, corporation:
|
|
29
|
+
individual = create(:customer_vault_individual, corporation:)
|
|
30
30
|
expect(individual.activity_type).to eq corporation.activity_type
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ RSpec.describe ::Dorsale::CustomerVault::Individual, :type => :model do
|
|
|
37
37
|
|
|
38
38
|
it "should have no activity if his corporation has no activity" do
|
|
39
39
|
corporation = create(:customer_vault_corporation, activity_type: nil)
|
|
40
|
-
individual = create(:customer_vault_individual, corporation:
|
|
40
|
+
individual = create(:customer_vault_individual, corporation:)
|
|
41
41
|
expect(individual.activity_type).to eq nil
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
3
|
+
RSpec.describe Dorsale::CustomerVault::Person, type: :model do
|
|
4
4
|
describe "#links" do
|
|
5
5
|
let!(:c) { create(:customer_vault_corporation) }
|
|
6
6
|
let!(:i) { create(:customer_vault_individual) }
|
|
@@ -28,7 +28,7 @@ RSpec.describe ::Dorsale::CustomerVault::Person, type: :model do
|
|
|
28
28
|
|
|
29
29
|
it "should return self_and_related_events" do
|
|
30
30
|
corporation = create(:customer_vault_corporation)
|
|
31
|
-
individual = create(:customer_vault_individual, corporation:
|
|
31
|
+
individual = create(:customer_vault_individual, corporation:)
|
|
32
32
|
corporation_event = create(:customer_vault_event, person: corporation)
|
|
33
33
|
individual_event = create(:customer_vault_event, person: individual)
|
|
34
34
|
|