dorsale 3.1.7 → 3.2.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.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/app/assets/javascripts/dorsale/common/comments.coffee +18 -20
  4. data/app/assets/javascripts/dorsale/common/datepicker.coffee +1 -1
  5. data/app/assets/javascripts/dorsale/common/forms.coffee +1 -1
  6. data/app/assets/javascripts/dorsale/common/modals.coffee +1 -1
  7. data/app/assets/javascripts/dorsale/common/tabs_loader.coffee +1 -1
  8. data/app/assets/javascripts/dorsale/common/tags.coffee +1 -1
  9. data/app/assets/javascripts/dorsale/common/tooltips.coffee +1 -1
  10. data/app/assets/javascripts/dorsale/dependencies.coffee +2 -0
  11. data/app/assets/javascripts/dorsale/engines/billing_machine.coffee +1 -1
  12. data/app/assets/stylesheets/dorsale/all.sass +1 -1
  13. data/app/assets/stylesheets/dorsale/common/comments.sass +1 -1
  14. data/app/assets/stylesheets/dorsale/common/filters.sass +16 -1
  15. data/app/assets/stylesheets/dorsale/common/styles.sass +3 -0
  16. data/app/assets/stylesheets/dorsale/engines/customer_vault.sass +2 -2
  17. data/app/assets/stylesheets/dorsale/engines/expense_gun.sass +3 -0
  18. data/app/assets/stylesheets/dorsale/engines/flyboy.sass +4 -0
  19. data/app/assets/stylesheets/dorsale/print.sass +73 -0
  20. data/app/controllers/dorsale/alexandrie/attachments_controller.rb +0 -4
  21. data/app/controllers/dorsale/application_controller.rb +12 -0
  22. data/app/controllers/dorsale/billing_machine/application_controller.rb +0 -5
  23. data/app/controllers/dorsale/billing_machine/id_cards_controller.rb +0 -4
  24. data/app/controllers/dorsale/billing_machine/invoices_controller.rb +0 -4
  25. data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +0 -4
  26. data/app/controllers/dorsale/billing_machine/quotations_controller.rb +0 -4
  27. data/app/controllers/dorsale/comments_controller.rb +30 -55
  28. data/app/controllers/dorsale/customer_vault/links_controller.rb +5 -5
  29. data/app/controllers/dorsale/customer_vault/people_controller.rb +9 -11
  30. data/app/controllers/dorsale/expense_gun/categories_controller.rb +0 -4
  31. data/app/controllers/dorsale/expense_gun/expenses_controller.rb +1 -5
  32. data/app/controllers/dorsale/flyboy/folders_controller.rb +0 -4
  33. data/app/controllers/dorsale/flyboy/tasks_controller.rb +0 -4
  34. data/app/controllers/dorsale/users_controller.rb +7 -11
  35. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_customer.rb +1 -1
  36. data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
  37. data/app/helpers/dorsale/all_helpers.rb +1 -0
  38. data/app/helpers/dorsale/billing_machine/application_helper.rb +23 -0
  39. data/app/helpers/dorsale/comments_helper.rb +14 -2
  40. data/app/helpers/dorsale/flyboy/application_helper.rb +4 -0
  41. data/app/helpers/dorsale/text_helper.rb +12 -7
  42. data/app/libs/dorsale/sortable_uuid_generator.rb +11 -0
  43. data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +2 -4
  44. data/app/models/concerns/dorsale/active_record_uuid_concern.rb +15 -0
  45. data/app/models/concerns/dorsale/default_values_concern.rb +13 -0
  46. data/app/models/dorsale/alexandrie/attachment.rb +3 -3
  47. data/app/models/dorsale/application_record.rb +11 -0
  48. data/app/models/dorsale/billing_machine/invoice.rb +13 -13
  49. data/app/models/dorsale/billing_machine/invoice_line.rb +3 -9
  50. data/app/models/dorsale/billing_machine/quotation.rb +6 -12
  51. data/app/models/dorsale/billing_machine/quotation_line.rb +3 -8
  52. data/app/models/dorsale/customer_vault/person.rb +5 -4
  53. data/app/models/dorsale/expense_gun/expense.rb +3 -4
  54. data/app/models/dorsale/expense_gun/expense_line.rb +4 -5
  55. data/app/models/dorsale/flyboy/folder.rb +2 -3
  56. data/app/models/dorsale/flyboy/task.rb +5 -6
  57. data/app/models/dorsale/flyboy/task_comment.rb +3 -8
  58. data/app/models/dorsale/users/active.rb +1 -1
  59. data/app/policies/dorsale/billing_machine/invoice_policy_helper.rb +5 -0
  60. data/app/policies/dorsale/comment_policy_helper.rb +21 -0
  61. data/app/serializers/dorsale/serializers/xlsx.rb +13 -2
  62. data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -1
  63. data/app/views/dorsale/billing_machine/invoices/_filters.html.slim +1 -1
  64. data/app/views/dorsale/billing_machine/invoices/_form.html.slim +1 -1
  65. data/app/views/dorsale/billing_machine/invoices/_header_infos.html.slim +9 -4
  66. data/app/views/dorsale/billing_machine/invoices/_list.html.slim +3 -2
  67. data/app/views/dorsale/billing_machine/invoices/email.html.slim +6 -0
  68. data/app/views/dorsale/billing_machine/invoices/index.html.slim +1 -1
  69. data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +41 -0
  70. data/app/views/dorsale/billing_machine/quotations/_filters.html.slim +1 -1
  71. data/app/views/dorsale/billing_machine/quotations/_list.html.slim +4 -3
  72. data/app/views/dorsale/comments/_comment.html.slim +2 -2
  73. data/app/views/dorsale/comments/_comments.html.slim +5 -0
  74. data/app/views/dorsale/comments/_form.html.slim +5 -6
  75. data/app/views/dorsale/comments/_list.html.slim +1 -1
  76. data/app/views/dorsale/comments/edit.html.slim +1 -1
  77. data/app/views/dorsale/customer_vault/links/edit.html.slim +13 -17
  78. data/app/views/dorsale/customer_vault/links/index.html.slim +10 -0
  79. data/app/views/dorsale/customer_vault/links/new.html.slim +10 -14
  80. data/app/views/dorsale/customer_vault/people/_actions.html.slim +2 -2
  81. data/app/views/dorsale/customer_vault/people/_data_context.html.slim +1 -1
  82. data/app/views/dorsale/customer_vault/people/_index_tabs.html.slim +2 -2
  83. data/app/views/dorsale/customer_vault/people/_show_layout.html.slim +10 -0
  84. data/app/views/dorsale/customer_vault/people/_tabs.html.slim +24 -0
  85. data/app/views/dorsale/customer_vault/people/activity.slim +2 -3
  86. data/app/views/dorsale/customer_vault/people/edit.html.slim +1 -0
  87. data/app/views/dorsale/customer_vault/people/index.html.slim +2 -2
  88. data/app/views/dorsale/customer_vault/people/index.xlsx.ruby +49 -0
  89. data/app/views/dorsale/customer_vault/people/invoices.html.slim +5 -0
  90. data/app/views/dorsale/customer_vault/people/show.html.slim +5 -26
  91. data/app/views/dorsale/customer_vault/people/tasks.html.slim +4 -0
  92. data/app/views/dorsale/expense_gun/categories/_list.html.slim +4 -1
  93. data/app/views/dorsale/expense_gun/expenses/_list.html.slim +1 -1
  94. data/app/views/dorsale/expense_gun/expenses/show.html.slim +3 -3
  95. data/app/views/dorsale/flyboy/_filters.html.slim +3 -0
  96. data/app/views/dorsale/flyboy/folders/_form.html.slim +3 -1
  97. data/app/views/dorsale/flyboy/folders/_list.html.slim +2 -2
  98. data/app/views/dorsale/flyboy/task_comments/_list.html.slim +2 -2
  99. data/app/views/dorsale/flyboy/tasks/_form.html.slim +4 -1
  100. data/app/views/dorsale/flyboy/tasks/_list.html.slim +1 -1
  101. data/app/views/dorsale/flyboy/tasks/_summary_list.html.slim +6 -5
  102. data/app/views/dorsale/flyboy/tasks/index.html.slim +2 -4
  103. data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +23 -0
  104. data/app/views/dorsale/flyboy/tasks/summary.html.slim +0 -2
  105. data/config/locales/common.en.yml +2 -0
  106. data/config/locales/common.fr.yml +2 -0
  107. data/config/locales/customer_vault.en.yml +0 -6
  108. data/config/locales/customer_vault.fr.yml +0 -6
  109. data/config/locales/flyboy.en.yml +2 -0
  110. data/config/locales/flyboy.fr.yml +2 -0
  111. data/config/routes.rb +7 -2
  112. data/db/migrate/20161118071317_dorsale_add_missing_indexes.rb +25 -0
  113. data/features/billing_machine_invoices.feature +4 -2
  114. data/features/customer_vault_invoices.feature +10 -0
  115. data/features/customer_vault_tasks.feature +1 -1
  116. data/features/flyboy_tasks.feature +3 -15
  117. data/features/step_definitions/billing_machine_invoices_steps.rb +2 -6
  118. data/features/step_definitions/billing_machine_quotations_steps.rb +5 -5
  119. data/features/step_definitions/common_steps.rb +7 -1
  120. data/features/step_definitions/customer_vault_corporations_steps.rb +7 -7
  121. data/features/step_definitions/customer_vault_filters_steps.rb +3 -3
  122. data/features/step_definitions/customer_vault_individuals_steps.rb +1 -1
  123. data/features/step_definitions/customer_vault_invoices_steps.rb +7 -0
  124. data/features/step_definitions/customer_vault_links_steps.rb +5 -3
  125. data/features/step_definitions/customer_vault_people_steps.rb +1 -1
  126. data/features/step_definitions/customer_vault_search_steps.rb +4 -4
  127. data/features/step_definitions/customer_vault_tasks_steps.rb +6 -16
  128. data/features/step_definitions/expense_gun_expenses_steps.rb +2 -2
  129. data/features/step_definitions/flyboy_folders_steps.rb +5 -5
  130. data/features/step_definitions/flyboy_tasks_steps.rb +5 -29
  131. data/lib/dorsale/engine.rb +6 -1
  132. data/lib/dorsale/polymorphic_id.rb +1 -1
  133. data/lib/dorsale/version.rb +1 -1
  134. data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +3 -4
  135. data/spec/controllers/dorsale/comments_controller_spec.rb +3 -3
  136. data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +10 -0
  137. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +1 -13
  138. data/spec/factories/dorsale_comments.rb +3 -3
  139. data/spec/helpers/dorsale/text_helper_spec.rb +15 -0
  140. data/spec/{lib → libs}/active_record_comma_type_cast_spec.rb +0 -0
  141. data/spec/{lib → libs/dorsale}/polymorphic_id_spec.rb +0 -0
  142. data/spec/libs/dorsale/sortable_uuid_generator_spec.rb +29 -0
  143. data/spec/rails_helper.rb +2 -0
  144. data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +15 -0
  145. metadata +54 -18
  146. data/app/pdfs/dorsale/flyboy/roadmap.rb +0 -47
  147. data/app/views/dorsale/billing_machine/invoices/index.csv.ruby +0 -46
  148. data/app/views/dorsale/comments/_loader.html.slim +0 -5
  149. data/app/views/dorsale/comments/index.html.slim +0 -11
  150. data/app/views/dorsale/customer_vault/people/_activity_tab.html.slim +0 -4
  151. data/app/views/dorsale/customer_vault/people/_comment.html.slim +0 -1
  152. data/app/views/dorsale/customer_vault/people/_links_tab.html.slim +0 -7
  153. data/app/views/dorsale/customer_vault/people/_tasks_tab.html.slim +0 -1
  154. data/app/views/dorsale/customer_vault/people/index.xls.slim +0 -24
  155. data/app/views/dorsale/flyboy/tasks/index.csv.ruby +0 -24
  156. data/app/views/dorsale/flyboy/tasks/index.pdf.ruby +0 -6
  157. data/app/views/dorsale/flyboy/tasks/index.xls.erb +0 -29
@@ -11,10 +11,8 @@
11
11
  = search_form
12
12
 
13
13
  - content_for :actions
14
- - if policy(::Dorsale::Flyboy::Task).export?
15
- = download_button url_for(format: :csv), action: :export_csv
16
- = download_button url_for(format: :xls), action: :export_xls
17
- = download_button url_for(format: :pdf), action: :export_pdf
14
+ - if policy(model).export?
15
+ = download_button url_for(format: :xlsx), download: "#{model.ts}.xlsx"
18
16
 
19
17
  - content_for :table
20
18
  = render "dorsale/flyboy/tasks/list", tasks: @tasks, nested: false
@@ -0,0 +1,23 @@
1
+ data = [
2
+ [
3
+ model.t(:taskable),
4
+ model.t(:taskable_type),
5
+ model.t(:taskable_progress),
6
+ model.t(:name),
7
+ model.t(:progress),
8
+ model.t(:term),
9
+ ]
10
+ ]
11
+
12
+ @tasks_without_pagination.each do |task|
13
+ data << [
14
+ task.taskable.name,
15
+ task.taskable.class.t,
16
+ percentage(task.taskable.try(:progress)),
17
+ task.name,
18
+ percentage(task.progress),
19
+ date(task.term),
20
+ ]
21
+ end
22
+
23
+ Dorsale::Serializers::XLSX.new(data).render_inline
@@ -1,3 +1 @@
1
- h1 Tasks summary
2
-
3
1
  = render 'dorsale/flyboy/tasks/summary'
@@ -151,6 +151,7 @@ en:
151
151
  addressable : "Origin"
152
152
  attachable : "Origin"
153
153
  email_subject : "Subject"
154
+ email_from : "Sender"
154
155
  email_to : "Recipient"
155
156
  email_attachment : "Attachment"
156
157
  email_body : "Message"
@@ -161,6 +162,7 @@ en:
161
162
 
162
163
  filters:
163
164
  all_customers: "All customers"
165
+ all_owners: "All all owners"
164
166
  date_begin: "Date begin"
165
167
  date_end: "Date end"
166
168
 
@@ -162,6 +162,7 @@ fr:
162
162
  addressable : "Origine"
163
163
  attachable : "Origine"
164
164
  email_subject : "Object"
165
+ email_from : "Expéditeur"
165
166
  email_to : "Destinataire"
166
167
  email_attachment : "Pièce jointe"
167
168
  email_body : "Message"
@@ -181,6 +182,7 @@ fr:
181
182
 
182
183
  filters:
183
184
  all_customers: "Tous les clients"
185
+ all_owners: "Tout le monde"
184
186
  date_begin: "Date début"
185
187
  date_end: "Date fin"
186
188
 
@@ -7,12 +7,6 @@ en:
7
7
  address_informations: "Address informations"
8
8
  additional_informations: "Additional informations"
9
9
 
10
- sections:
11
- activity: "Activity"
12
- links: "Links"
13
- tasks: "Tasks"
14
- people: "People"
15
-
16
10
  messages:
17
11
  no_people: "No people find."
18
12
  no_activity: "No recent activity."
@@ -7,12 +7,6 @@ fr:
7
7
  address_informations: "Adresse"
8
8
  additional_informations: "Informations complémentaires"
9
9
 
10
- sections:
11
- activity: "Activité"
12
- links: "Liens"
13
- tasks: "Tâches"
14
- people: "Personnes"
15
-
16
10
  messages:
17
11
  no_people: "Aucune personne trouvée."
18
12
  no_activity: "Aucune activité récente."
@@ -69,6 +69,8 @@ en:
69
69
 
70
70
  dorsale/flyboy/task:
71
71
  taskable: "Origin"
72
+ taskable_type: "Origin type"
73
+ taskable_progerss: "Origin progress"
72
74
  owner: "Owner"
73
75
  owner_id: "Owner"
74
76
  owner_guid: "Owner"
@@ -69,6 +69,8 @@ fr:
69
69
 
70
70
  dorsale/flyboy/task:
71
71
  taskable: "Origine"
72
+ taskable_type: "Type origine"
73
+ taskable_progress: "Progression origine"
72
74
  owner: "Propriétaire"
73
75
  owner_id: "Propriétaire"
74
76
  owner_guid: "Propriétaire"
data/config/routes.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  Dorsale::Engine.routes.draw do
2
2
  # Comments
3
3
 
4
- resources :comments, only: [:index, :create, :edit, :update, :destroy]
4
+ resources :comments, only: [:create, :edit, :update, :destroy]
5
5
 
6
6
  # Users
7
7
 
@@ -71,7 +71,12 @@ Dorsale::Engine.routes.draw do
71
71
  end
72
72
 
73
73
  resources :people do
74
- resources :links, except: [:index]
74
+ resources :links
75
+
76
+ member do
77
+ get :tasks
78
+ get :invoices
79
+ end
75
80
  end
76
81
 
77
82
  resources :corporations, path: "people", except: [:new] do
@@ -0,0 +1,25 @@
1
+ class DorsaleAddMissingIndexes < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_index :dorsale_customer_vault_people, :old_id
4
+ add_index :dorsale_expense_gun_expenses, :user_id
5
+ add_index :dorsale_addresses, :addressable_id
6
+ add_index :dorsale_addresses, :addressable_type
7
+ add_index :dorsale_alexandrie_attachments, :attachable_id
8
+ add_index :dorsale_alexandrie_attachments, :attachable_type
9
+ add_index :dorsale_alexandrie_attachments, :sender_id
10
+ add_index :dorsale_alexandrie_attachments, :sender_type
11
+ add_index :dorsale_billing_machine_invoices, :tracking_id
12
+ add_index :dorsale_billing_machine_quotations, :tracking_id
13
+ add_index :dorsale_comments, :author_id
14
+ add_index :dorsale_comments, :user_type
15
+ add_index :dorsale_comments, :commentable_id
16
+ add_index :dorsale_comments, :commentable_type
17
+ add_index :dorsale_comments, :author_type
18
+ add_index :dorsale_customer_vault_links, :alice_id
19
+ add_index :dorsale_customer_vault_links, :bob_id
20
+ add_index :dorsale_flyboy_task_comments, :author_type
21
+ add_index :dorsale_flyboy_task_comments, :author_id
22
+ add_index :dorsale_flyboy_tasks, :owner_type
23
+ add_index :dorsale_flyboy_tasks, :owner_id
24
+ end
25
+ end
@@ -33,6 +33,7 @@ Feature: Invoice Management
33
33
  Then a new invoice is displayed with the informations
34
34
 
35
35
  Scenario: Send invoice by email
36
+ Given an existing customer
36
37
  And an existing invoice
37
38
  When the user goes to the invoice details
38
39
  And he send invoice to customer by email
@@ -141,10 +142,11 @@ Feature: Invoice Management
141
142
  And the VAT due is "196,00"
142
143
  And the total including taxes is "1 196,00"
143
144
 
144
- Scenario: Export invoices in CSV
145
+ Scenario: Export invoices in XLSX
145
146
  And an existing invoice
146
147
  When the user goes to the invoices page
147
- Then he finds and clicks on the download CSV export file
148
+ When I export to XLSX
149
+ Then I download XLSX file
148
150
 
149
151
  Scenario: Existing unpaid invoice set to paid
150
152
  And an existing invoice
@@ -0,0 +1,10 @@
1
+ @javascript
2
+ Feature: People invoices
3
+ Background:
4
+ Given an authenticated user
5
+
6
+ Scenario: List person invoices
7
+ Given an existing corporation
8
+ And this corporation has an invoice
9
+ When he go on he corporation invoices page
10
+ Then he should see 1 invoices
@@ -27,7 +27,7 @@ Feature: Create tasks on people
27
27
  When I go on the general tasks page
28
28
  Then the task appear
29
29
 
30
- Scenario: Add a task to an individual
30
+ Scenario: Filter tasks on an individual
31
31
  Given an existing individual
32
32
  When I go on this individual
33
33
  And I go on the tasks section
@@ -44,23 +44,11 @@ Feature: Manage tasks
44
44
  Then I am on the tasks section
45
45
  And the task is snoozed
46
46
 
47
- Scenario: Export tasks to PDF
47
+ Scenario: Export tasks to XLSX
48
48
  Given 3 existing tasks
49
49
  When I go to the tasks section
50
- And I export tasks to PDF
51
- Then I download PDF file
52
-
53
- Scenario: Export tasks to CSV
54
- Given 3 existing tasks
55
- When I go to the tasks section
56
- And I export tasks to CSV
57
- Then I download CSV file
58
-
59
- Scenario: Export tasks to XLS
60
- Given 3 existing tasks
61
- When I go to the tasks section
62
- And I export tasks to XLS
63
- Then I download XLS file
50
+ And I export to XLSX
51
+ Then I download XLSX file
64
52
 
65
53
  Scenario: Filter tasks
66
54
  Given an existing done task
@@ -140,10 +140,6 @@ When(/^he saves the invoice$/) do
140
140
  find("[type=submit]").click
141
141
  end
142
142
 
143
- When(/^he finds and clicks on the download CSV export file$/) do
144
- find("[href$=csv]").click
145
- end
146
-
147
143
  When(/^he set the invoice as paid$/) do
148
144
  find("[href$=pay]").click
149
145
  end
@@ -159,7 +155,7 @@ When(/^he changes the advance to "(.*?)"€$/) do |value|
159
155
  end
160
156
 
161
157
  When(/^he goes to the newly created invoice page$/) do
162
- @invoice = ::Dorsale::BillingMachine::Invoice.unscoped.order(:id).last
158
+ @invoice = ::Dorsale::BillingMachine::Invoice.last_created
163
159
  visit dorsale.edit_billing_machine_invoice_path(@invoice)
164
160
  end
165
161
 
@@ -187,7 +183,7 @@ When(/^the user download the pdf$/) do
187
183
  find(".link_download").click
188
184
  end
189
185
 
190
- Then(/^he should see (\d+) invoices$/) do |count|
186
+ Then(/^he should see (\d+) invoices?$/) do |count|
191
187
  expect(page).to have_selector '.invoice', count: count
192
188
  end
193
189
 
@@ -170,7 +170,7 @@ Then(/^the quotation's label has changed$/) do
170
170
  end
171
171
 
172
172
  Then(/^I am on the created quotation$/) do
173
- @quotation = Dorsale::BillingMachine::Quotation.reorder(:id).last
173
+ @quotation = Dorsale::BillingMachine::Quotation.last_created
174
174
  expect(current_path).to eq dorsale.billing_machine_quotation_path(@quotation)
175
175
  end
176
176
 
@@ -184,7 +184,7 @@ Then(/^the quotation default date is set to today's date\.$/) do
184
184
  page.should have_field('quotation_date', with: I18n.l(Time.zone.now.to_date))
185
185
  end
186
186
 
187
- Then(/^he should see (\d+) quotations$/) do |arg1|
187
+ Then(/^he should see (\d+) quotations?$/) do |arg1|
188
188
  page.should have_selector '.quotation', count: arg1
189
189
  end
190
190
 
@@ -201,7 +201,7 @@ Then(/^he will see links to the documents$/) do
201
201
  end
202
202
 
203
203
  Then(/^the quotation informations are visible on the quotation details$/) do
204
- @quotation = ::Dorsale::BillingMachine::Quotation.unscoped.order(:id).last
204
+ @quotation = ::Dorsale::BillingMachine::Quotation.last_created
205
205
  visit dorsale.billing_machine_quotation_path(@quotation)
206
206
  expect(page).to have_content @payment_term.label
207
207
  expect(page).to have_content "I-am-a-comment"
@@ -217,13 +217,13 @@ end
217
217
 
218
218
  Then(/^he is on the created quotation edit page$/) do
219
219
  expect(Dorsale::BillingMachine::Quotation.count).to eq(@quotations_count+1)
220
- @quotation = Dorsale::BillingMachine::Quotation.reorder(:id).last
220
+ @quotation = Dorsale::BillingMachine::Quotation.last_created
221
221
  expect(current_path).to eq dorsale.edit_billing_machine_quotation_path(@quotation)
222
222
  end
223
223
 
224
224
  Then(/^an invoice is created from quotation$/) do
225
225
  expect(Dorsale::BillingMachine::Invoice.count).to eq(@invoices_count+1)
226
- @invoice = Dorsale::BillingMachine::Invoice.reorder(:id).last
226
+ @invoice = Dorsale::BillingMachine::Invoice.last_created
227
227
  expect(@invoice.label).to eq @quotation.label
228
228
  end
229
229
 
@@ -24,7 +24,6 @@ Given(/^an authenticated user$/) do
24
24
  sign_in @user
25
25
  end
26
26
 
27
-
28
27
  Given(/^an active user$/) do
29
28
  @user = create(:user)
30
29
  end
@@ -53,3 +52,10 @@ end
53
52
  Then(/^he see the "([^"]*)" filter$/) do |id|
54
53
  expect(page).to have_selector("#filters_#{id}")
55
54
  end
55
+
56
+ When(/^(?:I|he|she) export to XLSX$/) do
57
+ find("a[href$=xlsx]").click
58
+ end
59
+
60
+ When(/^(?:I|he|she) download XLSX file$/) do
61
+ end
@@ -53,7 +53,7 @@ end
53
53
 
54
54
  Then(/^the corporation is created$/) do
55
55
  expect(Dorsale::CustomerVault::Corporation.count).to eq(@corporations_count + 1)
56
- @corporation = Dorsale::CustomerVault::Corporation.reorder(:id).last
56
+ @corporation = Dorsale::CustomerVault::Corporation.last_created
57
57
 
58
58
  expect(@corporation.corporation_name).to eq "AGILiDEE"
59
59
  end
@@ -97,7 +97,7 @@ end
97
97
 
98
98
  Then(/^I see do not see my comment$/) do
99
99
  expect(Dorsale::Comment.count).to eq(@comments_count - 1)
100
- expect(page).to_not have_content @comment.text
100
+ expect(page).to have_no_content @comment.text
101
101
  end
102
102
 
103
103
  Given(/^an existing individual with recent comments$/) do
@@ -155,8 +155,8 @@ end
155
155
 
156
156
  Then(/^tags are added$/) do
157
157
  expect(all(".tag").count).to eq 2
158
- expect(page.body).to have_content "mytag1"
159
- expect(page.body).to have_content "mytag2"
158
+ expect(page).to have_content "mytag1"
159
+ expect(page).to have_content "mytag2"
160
160
  end
161
161
 
162
162
  Given(/^an existing corporation with tags$/) do
@@ -169,8 +169,8 @@ end
169
169
 
170
170
  Then(/^tags are removed$/) do
171
171
  expect(all(".tag").count).to eq 1
172
- expect(page.body).to_not have_content "mytag1"
173
- expect(page.body).to have_content "mytag2"
172
+ expect(page).to have_no_content "mytag1"
173
+ expect(page).to have_content "mytag2"
174
174
  end
175
175
 
176
176
  Given(/^an open task to this corporation$/) do
@@ -187,7 +187,7 @@ end
187
187
 
188
188
  Then(/^I see only the open task in the context$/) do
189
189
  expect(find("#context")).to have_content "I-am-open"
190
- expect(find("#context")).to_not have_content "I-am-closed"
190
+ expect(find("#context")).to have_no_content "I-am-closed"
191
191
  end
192
192
 
193
193
  Then(/^I see the link in the context$/) do
@@ -22,7 +22,7 @@ end
22
22
  Then(/^only first and second corporation appear$/) do
23
23
  expect(page).to have_content @corporation1.name
24
24
  expect(page).to have_content @corporation2.name
25
- expect(page).to_not have_content @corporation3.name
25
+ expect(page).to have_no_content @corporation3.name
26
26
  end
27
27
 
28
28
  When(/^I add the second tag world$/) do
@@ -32,6 +32,6 @@ end
32
32
 
33
33
  Then(/^only the first corporation appear$/) do
34
34
  expect(page).to have_content @corporation1.name
35
- expect(page).to_not have_content @corporation2.name
36
- expect(page).to_not have_content @corporation3.name
35
+ expect(page).to have_no_content @corporation2.name
36
+ expect(page).to have_no_content @corporation3.name
37
37
  end
@@ -30,7 +30,7 @@ end
30
30
  Then(/^the individual is created$/) do
31
31
  expect(Dorsale::CustomerVault::Individual.count).to eq(@individuals_count + 1)
32
32
 
33
- @individual = Dorsale::CustomerVault::Individual.reorder(:id).last
33
+ @individual = Dorsale::CustomerVault::Individual.last_created
34
34
 
35
35
  expect(@individual.first_name).to eq "Benoit"
36
36
  expect(@individual.last_name).to eq "Gantaume"
@@ -0,0 +1,7 @@
1
+ Given(/^this (?:corporation|individual|person) has an invoice$/) do
2
+ @invoice = create(:billing_machine_invoice, customer: @person)
3
+ end
4
+
5
+ When(/^he go on he (?:corporation|individual|person) invoices page$/) do
6
+ visit dorsale.invoices_customer_vault_person_path(@person)
7
+ end
@@ -1,10 +1,12 @@
1
1
 
2
2
  Given(/^an existing corporation$/) do
3
- @corporation= create(:customer_vault_corporation)
3
+ @corporation = create(:customer_vault_corporation)
4
+ @person = @corporation
4
5
  end
5
6
 
6
7
  Given(/^an existing indidual$/) do
7
8
  @individual = create(:customer_vault_individual)
9
+ @person = @individual
8
10
  end
9
11
 
10
12
  Given(/^an existing link$/) do
@@ -19,12 +21,12 @@ When(/^I navigate to the link section of the indidual details$/) do
19
21
  end
20
22
 
21
23
  When(/^I add a new link to the corporation$/) do
22
- find(".tab-content [href$='links/new']").click
24
+ find("#context-main [href$='links/new']").click
23
25
  expect(current_path).to eq dorsale.new_customer_vault_corporation_link_path(@corporation)
24
26
  end
25
27
 
26
28
  When(/^I add a new link to the individual$/) do
27
- find(".tab-content [href$='links/new']").click
29
+ find("#context-main [href$='links/new']").click
28
30
  expect(current_path).to eq dorsale.new_customer_vault_individual_link_path(@individual)
29
31
  end
30
32