dorsale 3.14.3 → 3.14.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Rakefile +2 -0
- data/app/pdfs/dorsale/application_pdf.rb +11 -1
- data/app/pdfs/dorsale/expense_gun/expense_pdf.rb +75 -0
- data/app/views/dorsale/expense_gun/expenses/_show_actions.html.slim +2 -0
- data/app/views/dorsale/expense_gun/expenses/show.pdf.ruby +3 -0
- data/lib/dorsale/version.rb +1 -1
- metadata +125 -358
- data/features/access.feature +0 -17
- data/features/billing_machine_invoices.feature +0 -261
- data/features/billing_machine_multiple_vat.feature +0 -53
- data/features/billing_machine_payment_terms.feature +0 -19
- data/features/billing_machine_quotations.feature +0 -193
- data/features/customer_vault_activity_types.feature +0 -19
- data/features/customer_vault_corporations.feature +0 -95
- data/features/customer_vault_filters.feature +0 -14
- data/features/customer_vault_individuals.feature +0 -35
- data/features/customer_vault_invoices.feature +0 -10
- data/features/customer_vault_links.feature +0 -54
- data/features/customer_vault_origins.feature +0 -19
- data/features/customer_vault_people.feature +0 -25
- data/features/customer_vault_search.feature +0 -22
- data/features/customer_vault_tasks.feature +0 -35
- data/features/expense_gun_categories.feature +0 -19
- data/features/expense_gun_expenses.feature +0 -60
- data/features/flyboy_task_comments.feature +0 -21
- data/features/flyboy_tasks.feature +0 -122
- data/features/flyboy_tasks_summary.feature +0 -22
- data/features/step_definitions/access_steps.rb +0 -15
- data/features/step_definitions/alexandrie_steps.rb +0 -25
- data/features/step_definitions/billing_machine_invoices_steps.rb +0 -377
- data/features/step_definitions/billing_machine_multiple_vat.rb +0 -19
- data/features/step_definitions/billing_machine_payment_terms_steps.rb +0 -42
- data/features/step_definitions/billing_machine_quotations_steps.rb +0 -248
- data/features/step_definitions/common_steps.rb +0 -91
- data/features/step_definitions/customer_vault_activity_types_steps.rb +0 -42
- data/features/step_definitions/customer_vault_corporations_steps.rb +0 -218
- data/features/step_definitions/customer_vault_filters_steps.rb +0 -37
- data/features/step_definitions/customer_vault_individuals_steps.rb +0 -67
- data/features/step_definitions/customer_vault_invoices_steps.rb +0 -7
- data/features/step_definitions/customer_vault_links_steps.rb +0 -73
- data/features/step_definitions/customer_vault_origins_steps.rb +0 -42
- data/features/step_definitions/customer_vault_people_steps.rb +0 -26
- data/features/step_definitions/customer_vault_search_steps.rb +0 -48
- data/features/step_definitions/customer_vault_tasks_steps.rb +0 -34
- data/features/step_definitions/expense_gun_categories_steps.rb +0 -50
- data/features/step_definitions/expense_gun_expenses_steps.rb +0 -135
- data/features/step_definitions/flyboy_task_comments_steps.rb +0 -10
- data/features/step_definitions/flyboy_tasks_steps.rb +0 -196
- data/features/step_definitions/tasks_summary_steps.rb +0 -30
- data/features/step_definitions/users_management_step.rb +0 -29
- data/features/support/env.rb +0 -8
- data/features/users_management.feature +0 -18
- data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +0 -145
- data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +0 -153
- data/spec/controllers/dorsale/billing_machine/quotations_controller_spec.rb +0 -24
- data/spec/controllers/dorsale/comments_controller_spec.rb +0 -50
- data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +0 -42
- data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +0 -129
- data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +0 -45
- data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +0 -40
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +0 -349
- data/spec/factories/alexandrie_attachment_types.rb +0 -5
- data/spec/factories/alexandrie_attachments.rb +0 -16
- data/spec/factories/billing_machine_invoice_lines.rb +0 -9
- data/spec/factories/billing_machine_invoices.rb +0 -9
- data/spec/factories/billing_machine_payment_terms.rb +0 -5
- data/spec/factories/billing_machine_quotation_lines.rb +0 -9
- data/spec/factories/billing_machine_quotations.rb +0 -9
- data/spec/factories/customer_vault_activity_types.rb +0 -5
- data/spec/factories/customer_vault_corporations.rb +0 -13
- data/spec/factories/customer_vault_event.rb +0 -13
- data/spec/factories/customer_vault_individuals.rb +0 -17
- data/spec/factories/customer_vault_links.rb +0 -7
- data/spec/factories/customer_vault_origins.rb +0 -5
- data/spec/factories/dorsale_addresses.rb +0 -9
- data/spec/factories/dorsale_comments.rb +0 -7
- data/spec/factories/expense_gun_categories.rb +0 -7
- data/spec/factories/expense_gun_expense_lines.rb +0 -10
- data/spec/factories/expense_gun_expenses.rb +0 -13
- data/spec/factories/flyboy_task_comments.rb +0 -9
- data/spec/factories/flyboy_tasks.rb +0 -8
- data/spec/files/avatar.png +0 -0
- data/spec/files/pdf.pdf +0 -0
- data/spec/mailers/user_mailer_spec.rb +0 -21
- data/spec/models/dorsale/address_spec.rb +0 -46
- data/spec/models/dorsale/alexandrie/attachment_spec.rb +0 -36
- data/spec/models/dorsale/alexandrie/attachment_type_spec.rb +0 -11
- data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +0 -52
- data/spec/models/dorsale/billing_machine/invoice_spec.rb +0 -258
- data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +0 -51
- data/spec/models/dorsale/billing_machine/quotation_spec.rb +0 -213
- data/spec/models/dorsale/billing_machine_spec.rb +0 -57
- data/spec/models/dorsale/comment_spec.rb +0 -24
- data/spec/models/dorsale/customer_vault/activity_type_spec.rb +0 -10
- data/spec/models/dorsale/customer_vault/corporation_spec.rb +0 -33
- data/spec/models/dorsale/customer_vault/event_spec.rb +0 -22
- data/spec/models/dorsale/customer_vault/individual_spec.rb +0 -44
- data/spec/models/dorsale/customer_vault/link_spec.rb +0 -14
- data/spec/models/dorsale/customer_vault/origin_spec.rb +0 -8
- data/spec/models/dorsale/customer_vault/person_spec.rb +0 -112
- data/spec/models/dorsale/email_spec.rb +0 -39
- data/spec/models/dorsale/expense_gun/category_spec.rb +0 -9
- data/spec/models/dorsale/expense_gun/expense_line_spec.rb +0 -59
- data/spec/models/dorsale/expense_gun/expense_spec.rb +0 -176
- data/spec/models/dorsale/flyboy/task_comment_spec.rb +0 -54
- data/spec/models/dorsale/flyboy/task_spec.rb +0 -254
- data/spec/models/dorsale/i18n_spec.rb +0 -30
- data/spec/models/dorsale/users_spec.rb +0 -65
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +0 -42
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +0 -42
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +0 -42
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +0 -55
- data/spec/rails_helper.rb +0 -55
- data/spec/routing/dorsale/alexandrie/attachments_routing_spec.rb +0 -32
- data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +0 -67
- data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +0 -67
- data/spec/routing/dorsale/comments_routing_spec.rb +0 -23
- data/spec/routing/dorsale/customer_vault/activity_types_routing_spec.rb +0 -40
- data/spec/routing/dorsale/customer_vault/events_routing_spec.rb +0 -12
- data/spec/routing/dorsale/customer_vault/origins_routing_spec.rb +0 -40
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +0 -109
- data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +0 -62
- data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +0 -11
- data/spec/routing/dorsale/flyboy/tasks_routing_spec.rb +0 -51
- data/spec/routing/dorsale/users_routing_spec.rb +0 -38
- data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +0 -55
- data/spec/services/dorsale/billing_machine/quotation/statistics.rb +0 -23
- data/spec/services/dorsale/billing_machine/quotation/to_invoice_spec.rb +0 -46
- data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +0 -83
- data/spec/services/dorsale/flyboy/task/copy_spec.rb +0 -24
- data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +0 -117
- data/spec/spec_helper.rb +0 -86
- data/spec/support/devise.rb +0 -3
- data/spec/support/message_delivery.rb +0 -5
@@ -1,62 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe ::Dorsale::ExpenseGun::ExpensesController, type: :routing do
|
4
|
-
routes { ::Dorsale::Engine.routes }
|
5
|
-
|
6
|
-
describe "routing" do
|
7
|
-
it "#index" do
|
8
|
-
expect(get "/expense_gun/expenses").to \
|
9
|
-
route_to("dorsale/expense_gun/expenses#index")
|
10
|
-
end
|
11
|
-
|
12
|
-
it "#new" do
|
13
|
-
expect(get "/expense_gun/expenses/new").to \
|
14
|
-
route_to("dorsale/expense_gun/expenses#new")
|
15
|
-
end
|
16
|
-
|
17
|
-
it "#create" do
|
18
|
-
expect(post "/expense_gun/expenses").to \
|
19
|
-
route_to("dorsale/expense_gun/expenses#create")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "#show" do
|
23
|
-
expect(get "/expense_gun/expenses/1").to \
|
24
|
-
route_to("dorsale/expense_gun/expenses#show", id: "1")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "#edit" do
|
28
|
-
expect(get "/expense_gun/expenses/1/edit").to \
|
29
|
-
route_to("dorsale/expense_gun/expenses#edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "#update" do
|
33
|
-
expect(patch "/expense_gun/expenses/1").to \
|
34
|
-
route_to("dorsale/expense_gun/expenses#update", id: "1")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "#submit" do
|
38
|
-
expect(patch "/expense_gun/expenses/1/submit").to \
|
39
|
-
route_to("dorsale/expense_gun/expenses#submit", id: "1")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "#accept" do
|
43
|
-
expect(patch "/expense_gun/expenses/1/accept").to \
|
44
|
-
route_to("dorsale/expense_gun/expenses#accept", id: "1")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "#refuse" do
|
48
|
-
expect(patch "/expense_gun/expenses/1/refuse").to \
|
49
|
-
route_to("dorsale/expense_gun/expenses#refuse", id: "1")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "#cancel" do
|
53
|
-
expect(patch "/expense_gun/expenses/1/cancel").to \
|
54
|
-
route_to("dorsale/expense_gun/expenses#cancel", id: "1")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "#copy" do
|
58
|
-
expect(get "/expense_gun/expenses/1/copy").to \
|
59
|
-
route_to("dorsale/expense_gun/expenses#copy", id: "1")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe ::Dorsale::Flyboy::TaskCommentsController, type: :routing do
|
4
|
-
describe "routing" do
|
5
|
-
routes { ::Dorsale::Engine.routes }
|
6
|
-
|
7
|
-
it "routes to #create" do
|
8
|
-
expect(post("flyboy/task_comments")).to route_to("dorsale/flyboy/task_comments#create")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe ::Dorsale::Flyboy::TasksController, type: :routing do
|
4
|
-
describe "routing" do
|
5
|
-
routes { ::Dorsale::Engine.routes }
|
6
|
-
|
7
|
-
it "routes to #index" do
|
8
|
-
expect(get("flyboy/tasks")).to route_to("dorsale/flyboy/tasks#index")
|
9
|
-
end
|
10
|
-
|
11
|
-
it "routes to #summary" do
|
12
|
-
expect(get("flyboy/tasks/summary")).to route_to("dorsale/flyboy/tasks#summary")
|
13
|
-
end
|
14
|
-
|
15
|
-
it "routes to #new" do
|
16
|
-
expect(get("flyboy/tasks/new")).to route_to("dorsale/flyboy/tasks#new")
|
17
|
-
end
|
18
|
-
|
19
|
-
it "routes to #show" do
|
20
|
-
expect(get("flyboy/tasks/1")).to route_to("dorsale/flyboy/tasks#show", id: "1")
|
21
|
-
end
|
22
|
-
|
23
|
-
it "routes to #edit" do
|
24
|
-
expect(get("flyboy/tasks/1/edit")).to route_to("dorsale/flyboy/tasks#edit", id: "1")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "routes to #create" do
|
28
|
-
expect(post("flyboy/tasks")).to route_to("dorsale/flyboy/tasks#create")
|
29
|
-
end
|
30
|
-
|
31
|
-
it "routes to #update" do
|
32
|
-
expect(patch("flyboy/tasks/1")).to route_to("dorsale/flyboy/tasks#update", id: "1")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "routes to #complete" do
|
36
|
-
expect(patch("flyboy/tasks/1/complete")).to route_to("dorsale/flyboy/tasks#complete", id: "1")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "routes to #snooze" do
|
40
|
-
expect(patch("flyboy/tasks/1/snooze")).to route_to("dorsale/flyboy/tasks#snooze", id: "1")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "routes to #destroy" do
|
44
|
-
expect(delete("flyboy/tasks/1")).to route_to("dorsale/flyboy/tasks#destroy", id: "1")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "routes to #copy" do
|
48
|
-
expect(get("flyboy/tasks/1/copy")).to route_to("dorsale/flyboy/tasks#copy", id: "1")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Dorsale::UsersController, type: :routing do
|
4
|
-
describe "routing" do
|
5
|
-
routes { ::Dorsale::Engine.routes }
|
6
|
-
it "routes to #index" do
|
7
|
-
expect(:get => "users").to route_to("dorsale/users#index")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "routes to #new" do
|
11
|
-
expect(:get => "users/new").to route_to("dorsale/users#new")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "route to #show" do
|
15
|
-
expect(:get => "users/1").to route_to("dorsale/users#show", :id => "1")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "routes to #edit" do
|
19
|
-
expect(:get => "users/1/edit").to route_to("dorsale/users#edit", :id => "1")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "routes to #create" do
|
23
|
-
expect(:post => "users").to route_to("dorsale/users#create")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "routes to #update via PUT" do
|
27
|
-
expect(:put => "users/1").to route_to("dorsale/users#update", :id => "1")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "routes to #update via PATCH" do
|
31
|
-
expect(:patch => "users/1").to route_to("dorsale/users#update", :id => "1")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "doesn't route to #destroy" do
|
35
|
-
expect(:delete => "users/1").not_to be_routable
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe Dorsale::BillingMachine::Quotation::Copy do
|
4
|
-
let(:quotation) {
|
5
|
-
quotation = create(:billing_machine_quotation)
|
6
|
-
|
7
|
-
quotation.update_columns(
|
8
|
-
:label => "ABC",
|
9
|
-
:date => 3.days.ago,
|
10
|
-
:state => "canceled",
|
11
|
-
:created_at => 3.days.ago,
|
12
|
-
:updated_at => 3.days.ago,
|
13
|
-
)
|
14
|
-
|
15
|
-
line = create(:billing_machine_quotation_line,
|
16
|
-
:quotation => quotation,
|
17
|
-
:label => "DEF",
|
18
|
-
)
|
19
|
-
|
20
|
-
quotation
|
21
|
-
}
|
22
|
-
|
23
|
-
let(:copy) {
|
24
|
-
Dorsale::BillingMachine::Quotation::Copy.(quotation)
|
25
|
-
}
|
26
|
-
|
27
|
-
it "should duplicate infos, lines, and documents" do
|
28
|
-
create(:alexandrie_attachment, attachable: quotation)
|
29
|
-
|
30
|
-
expect(copy).to be_persisted
|
31
|
-
|
32
|
-
expect(copy.label).to eq "ABC"
|
33
|
-
expect(copy.lines.count).to eq 1
|
34
|
-
expect(copy.lines.first.label).to eq "DEF"
|
35
|
-
expect(copy.attachments.count).to eq 1
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should reset date" do
|
39
|
-
expect(quotation.date).to_not eq Date.current
|
40
|
-
expect(copy.date).to eq Date.current
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should reset unique_index, tracking_id, created_at, updated_at" do
|
44
|
-
expect(quotation.unique_index).to_not eq copy.unique_index
|
45
|
-
expect(quotation.tracking_id).to_not eq copy.tracking_id
|
46
|
-
# WTF ? It fails only when running all tests
|
47
|
-
# expect(quotation.created_at).to_not eq copy.created_at
|
48
|
-
# expect(quotation.updated_at).to_not eq copy.updated_at
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should reset state to pending" do
|
52
|
-
expect(quotation.reload.state).to eq "canceled"
|
53
|
-
expect(copy.reload.state).to eq "pending"
|
54
|
-
end
|
55
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe Dorsale::BillingMachine::Quotation::Statistics do
|
4
|
-
let(:statistics) {
|
5
|
-
Dorsale::BillingMachine::Quotation::Statistics.new(Dorsale::BillingMachine::Quotation.all)
|
6
|
-
}
|
7
|
-
|
8
|
-
it "stats should not include canceled quotations" do
|
9
|
-
q1 = create(:billing_machine_quotation_line, quantity: 1, unit_price: 10)
|
10
|
-
q1.quotation.update!(state: "pending")
|
11
|
-
|
12
|
-
q2 = create(:billing_machine_quotation_line, quantity: 1, unit_price: 10)
|
13
|
-
q2.quotation.update!(state: "canceled")
|
14
|
-
|
15
|
-
expect(statistics.total_excluding_taxes).to eq 10
|
16
|
-
end
|
17
|
-
|
18
|
-
it "stats should be 0 if no quotations" do
|
19
|
-
expect(statistics.total_excluding_taxes).to eq 0
|
20
|
-
expect(statistics.vat_amount).to eq 0
|
21
|
-
expect(statistics.total_including_taxes).to eq 0
|
22
|
-
end
|
23
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe Dorsale::BillingMachine::Quotation::ToInvoice do
|
4
|
-
let(:quotation) {
|
5
|
-
quotation = create(:billing_machine_quotation)
|
6
|
-
|
7
|
-
quotation.update_columns(
|
8
|
-
:label => "ABC",
|
9
|
-
:date => 3.days.ago,
|
10
|
-
:state => "canceled",
|
11
|
-
:created_at => 3.days.ago,
|
12
|
-
:updated_at => 3.days.ago,
|
13
|
-
)
|
14
|
-
|
15
|
-
line = create(:billing_machine_quotation_line,
|
16
|
-
:quotation => quotation,
|
17
|
-
:label => "DEF",
|
18
|
-
)
|
19
|
-
|
20
|
-
quotation
|
21
|
-
}
|
22
|
-
|
23
|
-
let(:invoice) {
|
24
|
-
Dorsale::BillingMachine::Quotation::ToInvoice.(quotation)
|
25
|
-
}
|
26
|
-
|
27
|
-
it "should convert quotation to invoice" do
|
28
|
-
expect(invoice).to be_a Dorsale::BillingMachine::Invoice
|
29
|
-
expect(invoice).to_not be_persisted
|
30
|
-
expect(invoice.label).to eq "ABC"
|
31
|
-
expect(invoice.lines.length).to eq 1
|
32
|
-
expect(invoice.lines.first.label).to eq "DEF"
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should reset date" do
|
36
|
-
expect(quotation.date).to_not eq Time.zone.now.to_date
|
37
|
-
expect(invoice.date).to eq Time.zone.now.to_date
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should reset unique_index, tracking_id, created_at, updated_at" do
|
41
|
-
expect(invoice.unique_index).to_not eq quotation.unique_index
|
42
|
-
expect(invoice.tracking_id).to_not eq quotation.tracking_id
|
43
|
-
expect(invoice.created_at).to_not eq quotation.created_at
|
44
|
-
expect(invoice.updated_at).to_not eq quotation.updated_at
|
45
|
-
end
|
46
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Dorsale::ExpenseGun::Expense::Copy do
|
4
|
-
let(:expense) {
|
5
|
-
expense = Dorsale::ExpenseGun::Expense.create!(
|
6
|
-
:user => create(:user),
|
7
|
-
:name => "ExpenseName",
|
8
|
-
:date => Date.current,
|
9
|
-
:state => "accepted",
|
10
|
-
)
|
11
|
-
|
12
|
-
line = create(:expense_gun_expense_line,
|
13
|
-
:expense => expense,
|
14
|
-
:name => "ExpenseLineName",
|
15
|
-
:date => Date.current,
|
16
|
-
)
|
17
|
-
|
18
|
-
expense.reload
|
19
|
-
}
|
20
|
-
|
21
|
-
let(:copy) {
|
22
|
-
::Dorsale::ExpenseGun::Expense::Copy.(expense)
|
23
|
-
}
|
24
|
-
|
25
|
-
it "should duplicate expense attributes" do
|
26
|
-
expect(copy.name).to eq "ExpenseName"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should duplicate expense lines attributes" do
|
30
|
-
expect(copy.expense_lines.length).to eq 1
|
31
|
-
expense_line = copy.expense_lines.first
|
32
|
-
|
33
|
-
expect(expense_line.name).to eq "ExpenseLineName"
|
34
|
-
expect(expense_line.category).to be_present
|
35
|
-
expect(expense_line.category).to eq expense.expense_lines.first.category
|
36
|
-
expect(expense_line.total_all_taxes).to be_present
|
37
|
-
expect(expense_line.total_all_taxes).to eq expense.expense_lines.first.total_all_taxes
|
38
|
-
expect(expense_line.vat).to be_present
|
39
|
-
expect(expense_line.vat).to eq expense.expense_lines.first.vat
|
40
|
-
expect(expense_line.company_part).to be_present
|
41
|
-
expect(expense_line.company_part).to eq expense.expense_lines.first.company_part
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should not be persisted" do
|
45
|
-
expect(copy).to_not be_persisted
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should reset expense user" do
|
49
|
-
expect(expense.user).to be_present
|
50
|
-
expect(copy.user).to be_nil
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should reset expense date" do
|
54
|
-
expect(expense.date).to be_present
|
55
|
-
expect(copy.date).to be_nil
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should reset expense state" do
|
59
|
-
expect(expense.state).to eq "accepted"
|
60
|
-
expect(copy.state).to eq "draft"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should reset expense created_at/updated_at" do
|
64
|
-
expect(expense.created_at).to be_present
|
65
|
-
expect(copy.created_at).to be_nil
|
66
|
-
|
67
|
-
expect(expense.updated_at).to be_present
|
68
|
-
expect(copy.updated_at).to be_nil
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should reset expense line date" do
|
72
|
-
expect(expense.expense_lines.first.date).to be_present
|
73
|
-
expect(copy.expense_lines.first.date).to be_nil
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should reset expense lines created_at/updated_at" do
|
77
|
-
expect(expense.expense_lines.first.created_at).to be_present
|
78
|
-
expect(copy.expense_lines.first.created_at).to be_nil
|
79
|
-
|
80
|
-
expect(expense.expense_lines.first.updated_at).to be_present
|
81
|
-
expect(copy.expense_lines.first.updated_at).to be_nil
|
82
|
-
end
|
83
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe Dorsale::Flyboy::Task::Copy do
|
4
|
-
let(:task) {
|
5
|
-
create(:flyboy_task, done: true, progress: 50)
|
6
|
-
}
|
7
|
-
|
8
|
-
let(:copy) {
|
9
|
-
copy = Dorsale::Flyboy::Task::Copy.(task)
|
10
|
-
copy.save!
|
11
|
-
copy
|
12
|
-
}
|
13
|
-
|
14
|
-
it "is expected to duplicate the whole object" do
|
15
|
-
expect(copy).to be_persisted
|
16
|
-
expect(copy.name).to eq task.name
|
17
|
-
expect(copy.owner).to eq task.owner
|
18
|
-
expect(copy.description).to eq task.description
|
19
|
-
end
|
20
|
-
|
21
|
-
it "is expected to set the progress to 0" do
|
22
|
-
expect(copy.progress).to eq 0
|
23
|
-
end
|
24
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe Dorsale::Flyboy::Task::Snoozer do
|
4
|
-
describe "#snooze" do
|
5
|
-
it "should snooze term" do
|
6
|
-
task = create(:flyboy_task, term: "2017-04-13")
|
7
|
-
expect(task.snoozer.snooze).to be true
|
8
|
-
expect(task.term).to eq Date.parse("2017-04-20")
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should auto update reminder_date for duration reminder type" do
|
12
|
-
task = create(:flyboy_task,
|
13
|
-
:term => "2017-04-13",
|
14
|
-
:reminder_type => "duration",
|
15
|
-
:reminder_duration => 1,
|
16
|
-
:reminder_unit => "days",
|
17
|
-
)
|
18
|
-
expect(task.reminder_date).to eq Date.parse("2017-04-12")
|
19
|
-
|
20
|
-
expect(task.snoozer.snooze).to be true
|
21
|
-
expect(task.term).to eq Date.parse("2017-04-20")
|
22
|
-
expect(task.reminder_date).to eq Date.parse("2017-04-19")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should snooze reminder_date" do
|
26
|
-
task = create(:flyboy_task,
|
27
|
-
:term => "2017-04-13",
|
28
|
-
:reminder_type => "custom",
|
29
|
-
:reminder_date => "2017-04-12",
|
30
|
-
)
|
31
|
-
|
32
|
-
expect(task.snoozer.snooze).to be true
|
33
|
-
expect(task.term).to eq Date.parse("2017-04-20")
|
34
|
-
expect(task.reminder_date).to eq Date.parse("2017-04-19")
|
35
|
-
end
|
36
|
-
end # describe "#snooze"
|
37
|
-
|
38
|
-
describe "#snoozable?" do
|
39
|
-
before do
|
40
|
-
Timecop.freeze "2017-04-13 12:00:00"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should always be false if task is done" do
|
44
|
-
task = create(:flyboy_task,
|
45
|
-
:done => true,
|
46
|
-
:term => 1.day.ago,
|
47
|
-
:reminder_type => "custom",
|
48
|
-
:reminder_date => 2.days.ago,
|
49
|
-
)
|
50
|
-
|
51
|
-
expect(task.snoozer.snoozable?).to be false
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should true if term is today" do
|
55
|
-
task = create(:flyboy_task,
|
56
|
-
:done => false,
|
57
|
-
:term => Date.current,
|
58
|
-
:reminder_type => nil,
|
59
|
-
)
|
60
|
-
|
61
|
-
expect(task.snoozer.snoozable?).to be true
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should true if term is yesterday" do
|
65
|
-
task = create(:flyboy_task,
|
66
|
-
:done => false,
|
67
|
-
:term => Date.yesterday,
|
68
|
-
:reminder_type => nil,
|
69
|
-
)
|
70
|
-
|
71
|
-
expect(task.snoozer.snoozable?).to be true
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should false if term is tomorrow" do
|
75
|
-
task = create(:flyboy_task,
|
76
|
-
:done => false,
|
77
|
-
:term => Date.tomorrow,
|
78
|
-
:reminder_type => nil,
|
79
|
-
)
|
80
|
-
|
81
|
-
expect(task.snoozer.snoozable?).to be false
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should true if reminder_date is today" do
|
85
|
-
task = create(:flyboy_task,
|
86
|
-
:done => false,
|
87
|
-
:term => "2017-04-20", # future
|
88
|
-
:reminder_type => "custom",
|
89
|
-
:reminder_date => Date.current,
|
90
|
-
)
|
91
|
-
|
92
|
-
expect(task.snoozer.snoozable?).to be true
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should true if reminder_date is yesterday" do
|
96
|
-
task = create(:flyboy_task,
|
97
|
-
:done => false,
|
98
|
-
:term => "2017-04-20", # future
|
99
|
-
:reminder_type => "custom",
|
100
|
-
:reminder_date => Date.yesterday,
|
101
|
-
)
|
102
|
-
|
103
|
-
expect(task.snoozer.snoozable?).to be true
|
104
|
-
end
|
105
|
-
|
106
|
-
it "should false if reminder_date is tomorrow" do
|
107
|
-
task = create(:flyboy_task,
|
108
|
-
:done => false,
|
109
|
-
:term => "2017-04-20", # future
|
110
|
-
:reminder_type => "custom",
|
111
|
-
:reminder_date => Date.tomorrow,
|
112
|
-
)
|
113
|
-
|
114
|
-
expect(task.snoozer.snoozable?).to be false
|
115
|
-
end
|
116
|
-
end # describe "#snoozable?"
|
117
|
-
end
|