dorsale 3.14.3 → 3.14.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/Rakefile +2 -0
  4. data/app/pdfs/dorsale/application_pdf.rb +11 -1
  5. data/app/pdfs/dorsale/expense_gun/expense_pdf.rb +75 -0
  6. data/app/views/dorsale/expense_gun/expenses/_show_actions.html.slim +2 -0
  7. data/app/views/dorsale/expense_gun/expenses/show.pdf.ruby +3 -0
  8. data/lib/dorsale/version.rb +1 -1
  9. metadata +125 -358
  10. data/features/access.feature +0 -17
  11. data/features/billing_machine_invoices.feature +0 -261
  12. data/features/billing_machine_multiple_vat.feature +0 -53
  13. data/features/billing_machine_payment_terms.feature +0 -19
  14. data/features/billing_machine_quotations.feature +0 -193
  15. data/features/customer_vault_activity_types.feature +0 -19
  16. data/features/customer_vault_corporations.feature +0 -95
  17. data/features/customer_vault_filters.feature +0 -14
  18. data/features/customer_vault_individuals.feature +0 -35
  19. data/features/customer_vault_invoices.feature +0 -10
  20. data/features/customer_vault_links.feature +0 -54
  21. data/features/customer_vault_origins.feature +0 -19
  22. data/features/customer_vault_people.feature +0 -25
  23. data/features/customer_vault_search.feature +0 -22
  24. data/features/customer_vault_tasks.feature +0 -35
  25. data/features/expense_gun_categories.feature +0 -19
  26. data/features/expense_gun_expenses.feature +0 -60
  27. data/features/flyboy_task_comments.feature +0 -21
  28. data/features/flyboy_tasks.feature +0 -122
  29. data/features/flyboy_tasks_summary.feature +0 -22
  30. data/features/step_definitions/access_steps.rb +0 -15
  31. data/features/step_definitions/alexandrie_steps.rb +0 -25
  32. data/features/step_definitions/billing_machine_invoices_steps.rb +0 -377
  33. data/features/step_definitions/billing_machine_multiple_vat.rb +0 -19
  34. data/features/step_definitions/billing_machine_payment_terms_steps.rb +0 -42
  35. data/features/step_definitions/billing_machine_quotations_steps.rb +0 -248
  36. data/features/step_definitions/common_steps.rb +0 -91
  37. data/features/step_definitions/customer_vault_activity_types_steps.rb +0 -42
  38. data/features/step_definitions/customer_vault_corporations_steps.rb +0 -218
  39. data/features/step_definitions/customer_vault_filters_steps.rb +0 -37
  40. data/features/step_definitions/customer_vault_individuals_steps.rb +0 -67
  41. data/features/step_definitions/customer_vault_invoices_steps.rb +0 -7
  42. data/features/step_definitions/customer_vault_links_steps.rb +0 -73
  43. data/features/step_definitions/customer_vault_origins_steps.rb +0 -42
  44. data/features/step_definitions/customer_vault_people_steps.rb +0 -26
  45. data/features/step_definitions/customer_vault_search_steps.rb +0 -48
  46. data/features/step_definitions/customer_vault_tasks_steps.rb +0 -34
  47. data/features/step_definitions/expense_gun_categories_steps.rb +0 -50
  48. data/features/step_definitions/expense_gun_expenses_steps.rb +0 -135
  49. data/features/step_definitions/flyboy_task_comments_steps.rb +0 -10
  50. data/features/step_definitions/flyboy_tasks_steps.rb +0 -196
  51. data/features/step_definitions/tasks_summary_steps.rb +0 -30
  52. data/features/step_definitions/users_management_step.rb +0 -29
  53. data/features/support/env.rb +0 -8
  54. data/features/users_management.feature +0 -18
  55. data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +0 -145
  56. data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +0 -153
  57. data/spec/controllers/dorsale/billing_machine/quotations_controller_spec.rb +0 -24
  58. data/spec/controllers/dorsale/comments_controller_spec.rb +0 -50
  59. data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +0 -42
  60. data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +0 -129
  61. data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +0 -45
  62. data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +0 -40
  63. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +0 -349
  64. data/spec/factories/alexandrie_attachment_types.rb +0 -5
  65. data/spec/factories/alexandrie_attachments.rb +0 -16
  66. data/spec/factories/billing_machine_invoice_lines.rb +0 -9
  67. data/spec/factories/billing_machine_invoices.rb +0 -9
  68. data/spec/factories/billing_machine_payment_terms.rb +0 -5
  69. data/spec/factories/billing_machine_quotation_lines.rb +0 -9
  70. data/spec/factories/billing_machine_quotations.rb +0 -9
  71. data/spec/factories/customer_vault_activity_types.rb +0 -5
  72. data/spec/factories/customer_vault_corporations.rb +0 -13
  73. data/spec/factories/customer_vault_event.rb +0 -13
  74. data/spec/factories/customer_vault_individuals.rb +0 -17
  75. data/spec/factories/customer_vault_links.rb +0 -7
  76. data/spec/factories/customer_vault_origins.rb +0 -5
  77. data/spec/factories/dorsale_addresses.rb +0 -9
  78. data/spec/factories/dorsale_comments.rb +0 -7
  79. data/spec/factories/expense_gun_categories.rb +0 -7
  80. data/spec/factories/expense_gun_expense_lines.rb +0 -10
  81. data/spec/factories/expense_gun_expenses.rb +0 -13
  82. data/spec/factories/flyboy_task_comments.rb +0 -9
  83. data/spec/factories/flyboy_tasks.rb +0 -8
  84. data/spec/files/avatar.png +0 -0
  85. data/spec/files/pdf.pdf +0 -0
  86. data/spec/mailers/user_mailer_spec.rb +0 -21
  87. data/spec/models/dorsale/address_spec.rb +0 -46
  88. data/spec/models/dorsale/alexandrie/attachment_spec.rb +0 -36
  89. data/spec/models/dorsale/alexandrie/attachment_type_spec.rb +0 -11
  90. data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +0 -52
  91. data/spec/models/dorsale/billing_machine/invoice_spec.rb +0 -258
  92. data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +0 -51
  93. data/spec/models/dorsale/billing_machine/quotation_spec.rb +0 -213
  94. data/spec/models/dorsale/billing_machine_spec.rb +0 -57
  95. data/spec/models/dorsale/comment_spec.rb +0 -24
  96. data/spec/models/dorsale/customer_vault/activity_type_spec.rb +0 -10
  97. data/spec/models/dorsale/customer_vault/corporation_spec.rb +0 -33
  98. data/spec/models/dorsale/customer_vault/event_spec.rb +0 -22
  99. data/spec/models/dorsale/customer_vault/individual_spec.rb +0 -44
  100. data/spec/models/dorsale/customer_vault/link_spec.rb +0 -14
  101. data/spec/models/dorsale/customer_vault/origin_spec.rb +0 -8
  102. data/spec/models/dorsale/customer_vault/person_spec.rb +0 -112
  103. data/spec/models/dorsale/email_spec.rb +0 -39
  104. data/spec/models/dorsale/expense_gun/category_spec.rb +0 -9
  105. data/spec/models/dorsale/expense_gun/expense_line_spec.rb +0 -59
  106. data/spec/models/dorsale/expense_gun/expense_spec.rb +0 -176
  107. data/spec/models/dorsale/flyboy/task_comment_spec.rb +0 -54
  108. data/spec/models/dorsale/flyboy/task_spec.rb +0 -254
  109. data/spec/models/dorsale/i18n_spec.rb +0 -30
  110. data/spec/models/dorsale/users_spec.rb +0 -65
  111. data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +0 -42
  112. data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +0 -42
  113. data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +0 -42
  114. data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +0 -55
  115. data/spec/rails_helper.rb +0 -55
  116. data/spec/routing/dorsale/alexandrie/attachments_routing_spec.rb +0 -32
  117. data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +0 -67
  118. data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +0 -67
  119. data/spec/routing/dorsale/comments_routing_spec.rb +0 -23
  120. data/spec/routing/dorsale/customer_vault/activity_types_routing_spec.rb +0 -40
  121. data/spec/routing/dorsale/customer_vault/events_routing_spec.rb +0 -12
  122. data/spec/routing/dorsale/customer_vault/origins_routing_spec.rb +0 -40
  123. data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +0 -109
  124. data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +0 -62
  125. data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +0 -11
  126. data/spec/routing/dorsale/flyboy/tasks_routing_spec.rb +0 -51
  127. data/spec/routing/dorsale/users_routing_spec.rb +0 -38
  128. data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +0 -55
  129. data/spec/services/dorsale/billing_machine/quotation/statistics.rb +0 -23
  130. data/spec/services/dorsale/billing_machine/quotation/to_invoice_spec.rb +0 -46
  131. data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +0 -83
  132. data/spec/services/dorsale/flyboy/task/copy_spec.rb +0 -24
  133. data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +0 -117
  134. data/spec/spec_helper.rb +0 -86
  135. data/spec/support/devise.rb +0 -3
  136. data/spec/support/message_delivery.rb +0 -5
@@ -1,122 +0,0 @@
1
- @javascript
2
- Feature: Manage tasks
3
- Background:
4
- Given an authenticated user
5
-
6
- Scenario: Create a task
7
- When I go to the tasks section
8
- And I create a task
9
- Then the task is created
10
- And I go to the tasks section
11
-
12
- Scenario: Read a task
13
- Given an existing task
14
- When I go to the tasks section
15
- And I consult this task
16
- Then I see this task
17
-
18
- Scenario: Update a task
19
- Given an existing task
20
- When I go to the tasks section
21
- And I update this task
22
- Then I am on the updated task
23
- And the task is updated
24
-
25
- Scenario: Delete a task
26
- Given an existing task
27
- When I go to the tasks section
28
- And I delete this task
29
- Then I am on the tasks section
30
- And the task is deleted
31
-
32
- Scenario: Complete a task
33
- Given an existing task
34
- When I go to the tasks section
35
- And I complete this task
36
- Then I am on the tasks section
37
- And the task is completed
38
-
39
- Scenario: Snooze a task
40
- Given an existing snoozable task
41
- When I go to the tasks section
42
- And I snooze this task
43
- Then I am on the tasks section
44
- And the task is snoozed
45
-
46
- Scenario: Export tasks to XLSX
47
- Given 3 existing tasks
48
- When I go to the tasks section
49
- And I export to XLSX
50
- Then I download XLSX file
51
-
52
- Scenario: Filter tasks
53
- Given an existing done task
54
- And an existing undone task
55
- When I go to the tasks section
56
- And I filter tasks by done
57
- Then only done tasks appear
58
- When I filter tasks by undone
59
- Then only undone tasks appear
60
- When I reset filters
61
- Then all tasks appear
62
-
63
- Scenario: Search tasks
64
- Given an existing task named "Hello"
65
- And an existing task named "World"
66
- When I go to the tasks section
67
- And I search "Hello"
68
- Then only the "Hello" task appear
69
-
70
- Scenario: Tasks pagination
71
- Given 100 existing tasks
72
- When I go to the tasks section
73
- Then tasks are paginated
74
-
75
- Scenario: Term email with owner
76
- Given a task with an owner that's the term is today
77
- When the flyboy daily crons run
78
- Then the owner receive an email
79
-
80
- Scenario: Term email without owner
81
- Given a task without owner
82
- When the flyboy daily crons run
83
- Then no email is sent
84
-
85
- Scenario: Term email for closed task
86
- Given a closed task with an owner
87
- When the flyboy daily crons run
88
- Then no email is sent
89
-
90
- Scenario: Task term JS
91
- When I go on the new task page
92
- Then I do not see "#task_term_custom" element
93
- When I select "Aujourd'hui"
94
- Then I do not see "#task_term_custom" element
95
- When I submit
96
- Then selected task term is "Aujourd'hui"
97
- Then I do not see "#task_term_custom" element
98
- When I select "Choisir une date"
99
- Then I see "#task_term_custom" element
100
- And I fill "task_term_custom" with "15/06/2016"
101
- And I submit
102
- Then selected task term is "Choisir une date"
103
- And I see "#task_term_custom" element
104
- And "task_term_custom" has value "15/06/2016"
105
-
106
- Scenario: Task term JS
107
- When I go on the new task page
108
- Then I do not see "#task_reminder_duration" element
109
- Then I do not see "#task_reminder_unit" element
110
- Then I do not see "#task_reminder_date" element
111
- When I select "Durée"
112
- Then I see "#task_reminder_duration" element
113
- Then I see "#task_reminder_unit" element
114
- Then I do not see "#task_reminder_date" element
115
- When I select "Date"
116
- Then I do not see "#task_reminder_duration" element
117
- Then I do not see "#task_reminder_unit" element
118
- Then I see "#task_reminder_date" element
119
- When I select "Aucun"
120
- Then I do not see "#task_reminder_duration" element
121
- Then I do not see "#task_reminder_unit" element
122
- Then I do not see "#task_reminder_date" element
@@ -1,22 +0,0 @@
1
- Feature: Homepage
2
- As a user
3
- I want to see informations
4
- Classified on the homepage
5
-
6
- Background:
7
- Given an authenticated user
8
-
9
- Scenario: Expired tasks
10
- Given an expired tasks
11
- When he go to the tasks summary page
12
- Then the task is classed as 'expired'
13
-
14
- Scenario: Todays tasks
15
- Given a task that expire today
16
- When he go to the tasks summary page
17
- Then the task is classed as 'Expire Today'
18
-
19
- Scenario: Tomorrow tasks
20
- Given a task that expire tommorow
21
- When he go to the tasks summary page
22
- Then the task is classed as 'Expire tommorow'
@@ -1,15 +0,0 @@
1
- When(/^he try to access to the application$/) do
2
- visit root_path
3
- click_link "Connexion"
4
- fill_in "user_email", with: @user.email
5
- fill_in "user_password", with: @user.password
6
- find("[type=submit]").click
7
- end
8
-
9
- Then(/^a message signal that's the user is logged$/) do
10
- I18n.t("devise.sessions.signed_in")
11
- end
12
-
13
- Then(/^an error message signal that's account is inactive$/) do
14
- I18n.t("messages.users.inactive")
15
- end
@@ -1,25 +0,0 @@
1
- When(/^he add a new document$/) do
2
- execute_script %(
3
- $("[type=file]").show()
4
- )
5
-
6
- attach_file :attachment_file, Dorsale::Engine.root.join("spec/files/pdf.pdf"), visible: :all
7
-
8
- find("#new_attachment [type=submit]").click
9
- end
10
-
11
- When(/^he delete a document$/) do
12
- all(".attachment .link_delete").first.click
13
- end
14
-
15
- When(/^he update the document$/) do
16
- find(".attachment [href$=edit]").click
17
- fill_in :attachment_name, with: "new document name"
18
- find("#edit_attachment [type$=submit]").click
19
- sleep 1 # ajax
20
- end
21
-
22
- Then(/^the document is updated$/) do
23
- @attachment = Dorsale::Alexandrie::Attachment.reorder(:updated_at).last
24
- expect(@attachment.name).to eq "new document name"
25
- end
@@ -1,377 +0,0 @@
1
- Given(/^an existing emtpy invoice$/) do
2
- @invoice = create(:billing_machine_invoice, label: nil, customer: nil, payment_term_id: nil)
3
- @invoice.due_date = nil
4
- @invoice.save!
5
- end
6
-
7
- Given(/^(\d+) existing invoices$/) do |count|
8
- create_list(:billing_machine_invoice, count.to_i)
9
- end
10
-
11
- Given(/^an existing invoice$/) do
12
- @invoice = create(:billing_machine_invoice, customer: @customer)
13
- @invoice.lines.create!(quantity: 1, unit_price: 9.99)
14
- end
15
-
16
- Given(/^an existing invoice with a "(.*?)"% VAT rate$/) do |rate|
17
- @invoice = create(:billing_machine_invoice)
18
- create(:billing_machine_invoice_line, vat_rate: rate, invoice: @invoice)
19
- end
20
-
21
- Given(/^an existing paid invoice$/) do
22
- @invoice = create(:billing_machine_invoice, paid: true)
23
- end
24
-
25
- Given(/^billing machine in single vat mode$/) do
26
- ::Dorsale::BillingMachine.vat_mode = :single
27
- end
28
-
29
- Given(/^a bunch of existing invoices$/) do
30
- c1 = create(:customer_vault_corporation, name: "Bidule")
31
- c2 = create(:customer_vault_corporation, name: "Machin")
32
- c3 = create(:customer_vault_corporation, name: "Chose")
33
-
34
- i1 = create(:customer_vault_individual, first_name: "Oh")
35
- i2 = create(:customer_vault_individual, first_name: "Ah")
36
- i3 = create(:customer_vault_individual, first_name: "Eh")
37
-
38
- create(:billing_machine_invoice, customer: c1, date: Date.current, paid: true)
39
- create(:billing_machine_invoice, customer: c2, date: Date.current)
40
- create(:billing_machine_invoice, customer: c3, date: Date.current)
41
- create(:billing_machine_invoice, customer: c1, date: Date.current - 2.days)
42
-
43
- create(:billing_machine_invoice, customer: i1, date: Date.current - 3.days)
44
- create(:billing_machine_invoice, customer: i2, date: Date.current - 3.days)
45
- create(:billing_machine_invoice, customer: i3, date: Date.current - 3.days)
46
- end
47
-
48
- Given(/^an existing unpaid invoice$/) do
49
- @invoice = create(:billing_machine_invoice, paid: false)
50
- end
51
-
52
- Given(/^its due date is not yet passed$/) do
53
- @invoice.update!(due_date: (Date.current + 1))
54
- end
55
-
56
- Given(/^its due date is the same day$/) do
57
- @invoice.update!(due_date: Date.current)
58
- end
59
-
60
- Given(/^its due date is yesterday$$/) do
61
- @invoice.update!(due_date: (Date.current - 1))
62
- end
63
-
64
- Given(/^its due date is (\d+) days ago$/) do |days|
65
- @invoice.update!(due_date: (Date.current - days.to_i))
66
- end
67
-
68
- Given(/^existing "(.*?)" invoices with "(.*?)" amount$/) do |n, amount|
69
- n.to_i.times do
70
- create(:billing_machine_invoice_line, quantity: 1, unit_price: amount)
71
- end
72
- end
73
-
74
- When(/^(?:the user|he) goes to the invoices page$/) do
75
- visit dorsale.billing_machine_invoices_path
76
- end
77
-
78
- When(/^he creates a new invoice$/) do
79
- find(".link_create").click
80
- end
81
-
82
- When(/^he fills the reference, the date, the vat rate and the payment terms$/) do
83
- fill_in "invoice_label", with: @label = "My reference"
84
- fill_in "invoice_date", with: @date = "01/01/2014"
85
- fill_in "invoice_vat_rate", with: "20"
86
- select @payment_term.label
87
- end
88
-
89
- When(/^he chooses the customer$/) do
90
- select @customer.name
91
- end
92
-
93
- When(/^the user goes to the invoice details$/) do
94
- visit dorsale.billing_machine_invoice_path(@invoice)
95
- end
96
-
97
- When(/^wants to copy it$/) do
98
- find(".link_copy").click
99
- end
100
-
101
- When(/^he fills a line with "(.*?)", "(.*?)", "(.*?)", "(.*?)"$/) do |label, quantity, unit, unit_price|
102
- expect(page).to have_selector(".line")
103
-
104
- within all(".line").last do
105
- find(".line-label textarea").set label
106
- find(".line-quantity input").set quantity
107
- find(".line-unit input").set unit
108
- find(".line-unit_price input").set unit_price
109
- end
110
- end
111
-
112
- When(/^he goes on the edit page of the invoice$/) do
113
- visit dorsale.edit_billing_machine_invoice_path(@invoice)
114
- end
115
-
116
- When(/^changes the label$/) do
117
- @new_label= @invoice.label + " Edited"
118
- fill_in "invoice_label", with: @new_label
119
- end
120
-
121
- When(/^he changes the VAT rate to "(.*?)"$/) do |new_rate|
122
- fill_in "invoice_vat_rate", with: new_rate
123
- end
124
-
125
- When(/^he changes the commercial discount to "(.*?)"€$/) do |arg1|
126
- fill_in "invoice_commercial_discount", with: arg1
127
- end
128
-
129
- When(/^he adds a new line$/) do
130
- click_link "add-new-line"
131
- end
132
-
133
- When(/^he saves the invoice$/) do
134
- find("[type=submit]").click
135
- end
136
-
137
- When(/^he set the invoice as paid$/) do
138
- find("[href$=pay]").click
139
- end
140
-
141
- When(/^he marks the invoice as unpaid$/) do
142
- within ".form-group.select.invoice_paid" do
143
- select "No"
144
- end
145
- end
146
-
147
- When(/^he changes the advance to "(.*?)"€$/) do |value|
148
- fill_in "invoice_advance", with: value
149
- end
150
-
151
- When(/^he goes to the newly created invoice page$/) do
152
- @invoice = ::Dorsale::BillingMachine::Invoice.last_created
153
- visit dorsale.edit_billing_machine_invoice_path(@invoice)
154
- end
155
-
156
- When(/^he filters by date on today$/) do
157
- select "Aujourd'hui"
158
- find(".filter-submit").click
159
- end
160
-
161
- When(/^he filters by one customer$/) do
162
- within(".filters") do
163
- select("Bidule")
164
- find(".filter-submit").click
165
- end
166
- end
167
-
168
- When(/^he filters by status on paid$/) do
169
- within(".filters") do
170
- select("Payée")
171
- find(".filter-submit").click
172
- end
173
- end
174
-
175
- When(/^the user download the pdf$/) do
176
- visit dorsale.billing_machine_invoice_path(@invoice)
177
- find(".link_download").click
178
- end
179
-
180
- Then(/^he should see (\d+) invoices?$/) do |count|
181
- expect(page).to have_selector ".invoice", count: count
182
- end
183
-
184
- Then(/^the invoice is displayed correctly$/) do
185
- expect(page).to have_selector ".tracking_id", text: @invoice.tracking_id
186
- end
187
-
188
- Then(/^the total excluding taxes is "(.*?)"$/) do |total|
189
- expect(find(".total_excluding_taxes input").value).to eq total
190
- end
191
-
192
- Then(/^the VAT due is "(.*?)"$/) do |vat|
193
- expect(find(".vat_amount input").value).to eq vat
194
- end
195
-
196
- Then(/^the total including taxes is "(.*?)"$/) do |total|
197
- expect(find(".total_including_taxes input").value).to eq total
198
- end
199
-
200
- Then(/^he fill the commercial discount with "(.*?)"$/) do |value|
201
- find(".commercial_discount input").set value
202
- end
203
-
204
- Then(/^it's added to the invoice list$/) do
205
- step("the user goes to the invoices page")
206
- expect(page).to have_selector ".invoice .date", text: @date
207
- # There are no other invoices for this test so we should get the right number
208
- tracking_id = ::Dorsale::BillingMachine::Invoice.first.tracking_id
209
- expect(page).to have_selector ".invoice .tracking_id", text: tracking_id
210
- expect(page).to have_selector ".invoice .customer_name", text: @customer.name
211
- expect(page).to have_selector ".invoice .total_excluding_taxes", text: "180,00 €"
212
- end
213
-
214
- Then(/^the commercial discount is "(.*?)"€$/) do |discount|
215
- expect(find(".commercial_discount input").value).to eq discount
216
- end
217
-
218
- Then(/^the invoices's label has changed$/) do
219
- visit dorsale.edit_billing_machine_invoice_path(@invoice)
220
- expect(page).to have_field("invoice_label", with: @new_label)
221
- end
222
-
223
- Then(/^the VAT rate is "(.*?)"$/) do |rate|
224
- expect(find(".vat_rate input").value).to eq rate
225
- end
226
-
227
- Then(/^the new line total is "(.*?)"$/) do |value|
228
- within all(".line").last do
229
- expect(find(".line-total input").value).to eq value
230
- end
231
- end
232
-
233
- Then(/^the invoice is marked paid$/) do
234
- expect(page).to have_selector ".paid"
235
- end
236
-
237
- Then(/^can't set the invoice as paid again$/) do
238
- expect(page).to_not have_selector("[href$=pay]")
239
- end
240
-
241
- Then(/^the invoice is marked unpaid$/) do
242
- expect(page).to_not have_selector ".paid"
243
- end
244
-
245
- Then(/^the invoice status is set to unpaid$/) do
246
- expect(@invoice.reload.paid?).to be false
247
- end
248
-
249
- Then(/^the invoice status is set to paid$/) do
250
- expect(@invoice.reload.paid?).to be true
251
- end
252
-
253
- Then(/^a message signals the success of the update$/) do
254
- expect(find(".alert-success")).to be_visible
255
- end
256
-
257
- Then(/^a message signals the success of the creation$/) do
258
- expect(find(".alert-success")).to be_visible
259
- end
260
-
261
- Then(/^a message signals that the invoice is set to paid$/) do
262
- expect(find(".alert-success")).to be_visible
263
- end
264
-
265
- Then(/^the advance is "(.*?)"€$/) do |advance|
266
- expect(find(".advance input").value).to eq advance
267
- end
268
-
269
- Then(/^the balance is "(.*?)"$/) do |balance|
270
- expect(find(".balance input").value).to eq balance
271
- end
272
-
273
- Then(/^the invoice line shows the right date$/) do
274
- expect(page).to have_selector ".date", text: I18n.l(@invoice.date)
275
- end
276
-
277
- Then(/^the invoice line shows the right traking-id$/) do
278
- expect(page).to have_selector ".tracking_id", text: @invoice.tracking_id
279
- end
280
-
281
- Then(/^the invoice line shows the right total excluding taxes value$/) do
282
- expect(page).to have_selector ".total_excluding_taxes", text: "9,99 €"
283
- end
284
-
285
- Then(/^the invoice line shows the right total including taxes value$/) do
286
- expect(page).to have_selector ".total_including_taxes", text: "11,99 €"
287
- end
288
-
289
- Then(/^the invoice line shows the right customer's name$/) do
290
- expect(page).to have_selector ".customer_name", text: @customer.name
291
- end
292
-
293
- Then(/^the invoice default date is set to today's date\.$/) do
294
- expect(page).to have_field("invoice_date", with: I18n.l(Date.current))
295
- end
296
-
297
- Then(/^the invoice default due date is set to today's date\.$/) do
298
- expect(page).to have_field("invoice_due_date", with: I18n.l(Date.current + 30.days))
299
- end
300
-
301
- Then(/^a new invoice is displayed with the informations$/) do
302
- expect(page).to have_field("invoice_label", with: @invoice.label)
303
- end
304
-
305
- Then(/^he can see all the informations$/) do
306
- expect(page).to have_selector ".invoice-label", text: @invoice.label
307
- end
308
-
309
- Then(/^only the invoices of this customer do appear$/) do
310
- expect(page).to have_selector(".customer_name", text: "Bidule", count: 2)
311
- end
312
-
313
- Then(/^only the invoices of today do appear$/) do
314
- expect(page).to have_selector(".invoice", count: 3)
315
- end
316
-
317
- Then(/^only the invoices paid do appear$/) do
318
- expect(page).to have_selector(".invoice", count: 1)
319
- end
320
-
321
- Then(/^the invoice paid status should not have a color$/) do
322
- expect(find(".invoice")[:class]).to_not include("paid", "late", "onalert")
323
- end
324
-
325
- Then(/^the invoice status should be "(.*?)"$/) do |color|
326
- expect(find(".invoice")[:class]).to include(color)
327
- end
328
-
329
- Then(/^data total amount is "(.*?)"$/) do |text|
330
- expect(page).to have_content text
331
- end
332
-
333
- When(/^he send invoice to customer by email$/) do
334
- ActionMailer::Base.deliveries.clear
335
-
336
- Dorsale::BillingMachine::PdfFileGenerator.(@invoice)
337
- @invoice.customer = create(:customer_vault_corporation, email: "aaa@example.org")
338
- @invoice.save!
339
-
340
- find("[href$=email]").click
341
- fill_in :email_subject, with: "abc"
342
- fill_in :email_body, with: "def"
343
- find("[type=submit]").click
344
- end
345
-
346
- Then(/^an invoice is sent to customer$/) do
347
- expect(ActionMailer::Base.deliveries.count).to eq 1
348
- email = ActionMailer::Base.deliveries.first
349
-
350
- expect(email.to).to include "aaa@example.org"
351
- expect(email.subject).to eq "abc"
352
- expect(email.parts.first.body).to eq "def"
353
- expect(email.attachments.count).to eq 1
354
- end
355
-
356
- When(/^he filters invoices between two date$/) do
357
- fill_in :filters_bm_date_begin, with: I18n.l(Date.current)
358
- fill_in :filters_bm_date_end, with: I18n.l(Date.current)
359
- find(".filter-submit").click
360
- end
361
-
362
- When(/^he click on the preview invoice button$/) do
363
- @invoices_count = Dorsale::BillingMachine::Invoice.count
364
- controller = Dorsale::BillingMachine::InvoicesController
365
- expect_any_instance_of(controller).to receive(:preview).and_call_original
366
- expect_any_instance_of(controller).to_not receive(:create)
367
- expect_any_instance_of(controller).to_not receive(:update)
368
- find("#preview-button").click
369
- end
370
-
371
- Then(/^he see the invoice preview$/) do
372
- expect(windows.count).to eq 2
373
- end
374
-
375
- Then(/^no invoice is created$/) do
376
- expect(Dorsale::BillingMachine::Invoice.count).to eq @invoices_count
377
- end