dorsale 3.14.4 → 3.14.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/features/access.feature +17 -0
  4. data/features/billing_machine_invoices.feature +261 -0
  5. data/features/billing_machine_multiple_vat.feature +53 -0
  6. data/features/billing_machine_payment_terms.feature +19 -0
  7. data/features/billing_machine_quotations.feature +193 -0
  8. data/features/customer_vault_activity_types.feature +19 -0
  9. data/features/customer_vault_corporations.feature +95 -0
  10. data/features/customer_vault_filters.feature +14 -0
  11. data/features/customer_vault_individuals.feature +35 -0
  12. data/features/customer_vault_invoices.feature +10 -0
  13. data/features/customer_vault_links.feature +54 -0
  14. data/features/customer_vault_origins.feature +19 -0
  15. data/features/customer_vault_people.feature +25 -0
  16. data/features/customer_vault_search.feature +22 -0
  17. data/features/customer_vault_tasks.feature +35 -0
  18. data/features/expense_gun_categories.feature +19 -0
  19. data/features/expense_gun_expenses.feature +60 -0
  20. data/features/flyboy_task_comments.feature +21 -0
  21. data/features/flyboy_tasks.feature +122 -0
  22. data/features/flyboy_tasks_summary.feature +22 -0
  23. data/features/step_definitions/access_steps.rb +15 -0
  24. data/features/step_definitions/alexandrie_steps.rb +25 -0
  25. data/features/step_definitions/billing_machine_invoices_steps.rb +377 -0
  26. data/features/step_definitions/billing_machine_multiple_vat.rb +19 -0
  27. data/features/step_definitions/billing_machine_payment_terms_steps.rb +42 -0
  28. data/features/step_definitions/billing_machine_quotations_steps.rb +248 -0
  29. data/features/step_definitions/common_steps.rb +91 -0
  30. data/features/step_definitions/customer_vault_activity_types_steps.rb +42 -0
  31. data/features/step_definitions/customer_vault_corporations_steps.rb +218 -0
  32. data/features/step_definitions/customer_vault_filters_steps.rb +37 -0
  33. data/features/step_definitions/customer_vault_individuals_steps.rb +67 -0
  34. data/features/step_definitions/customer_vault_invoices_steps.rb +7 -0
  35. data/features/step_definitions/customer_vault_links_steps.rb +73 -0
  36. data/features/step_definitions/customer_vault_origins_steps.rb +42 -0
  37. data/features/step_definitions/customer_vault_people_steps.rb +26 -0
  38. data/features/step_definitions/customer_vault_search_steps.rb +48 -0
  39. data/features/step_definitions/customer_vault_tasks_steps.rb +34 -0
  40. data/features/step_definitions/expense_gun_categories_steps.rb +50 -0
  41. data/features/step_definitions/expense_gun_expenses_steps.rb +135 -0
  42. data/features/step_definitions/flyboy_task_comments_steps.rb +10 -0
  43. data/features/step_definitions/flyboy_tasks_steps.rb +196 -0
  44. data/features/step_definitions/tasks_summary_steps.rb +30 -0
  45. data/features/step_definitions/users_management_step.rb +29 -0
  46. data/features/support/env.rb +8 -0
  47. data/features/users_management.feature +18 -0
  48. data/lib/dorsale/version.rb +1 -1
  49. data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +145 -0
  50. data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +153 -0
  51. data/spec/controllers/dorsale/billing_machine/quotations_controller_spec.rb +24 -0
  52. data/spec/controllers/dorsale/comments_controller_spec.rb +50 -0
  53. data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +42 -0
  54. data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +129 -0
  55. data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +55 -0
  56. data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +40 -0
  57. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +349 -0
  58. data/spec/factories/alexandrie_attachment_types.rb +5 -0
  59. data/spec/factories/alexandrie_attachments.rb +16 -0
  60. data/spec/factories/billing_machine_invoice_lines.rb +9 -0
  61. data/spec/factories/billing_machine_invoices.rb +9 -0
  62. data/spec/factories/billing_machine_payment_terms.rb +5 -0
  63. data/spec/factories/billing_machine_quotation_lines.rb +9 -0
  64. data/spec/factories/billing_machine_quotations.rb +9 -0
  65. data/spec/factories/customer_vault_activity_types.rb +5 -0
  66. data/spec/factories/customer_vault_corporations.rb +13 -0
  67. data/spec/factories/customer_vault_event.rb +13 -0
  68. data/spec/factories/customer_vault_individuals.rb +17 -0
  69. data/spec/factories/customer_vault_links.rb +7 -0
  70. data/spec/factories/customer_vault_origins.rb +5 -0
  71. data/spec/factories/dorsale_addresses.rb +9 -0
  72. data/spec/factories/dorsale_comments.rb +7 -0
  73. data/spec/factories/expense_gun_categories.rb +7 -0
  74. data/spec/factories/expense_gun_expense_lines.rb +11 -0
  75. data/spec/factories/expense_gun_expenses.rb +13 -0
  76. data/spec/factories/flyboy_task_comments.rb +9 -0
  77. data/spec/factories/flyboy_tasks.rb +8 -0
  78. data/spec/files/avatar.png +0 -0
  79. data/spec/files/pdf.pdf +0 -0
  80. data/spec/mailers/user_mailer_spec.rb +21 -0
  81. data/spec/models/dorsale/address_spec.rb +46 -0
  82. data/spec/models/dorsale/alexandrie/attachment_spec.rb +36 -0
  83. data/spec/models/dorsale/alexandrie/attachment_type_spec.rb +11 -0
  84. data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +52 -0
  85. data/spec/models/dorsale/billing_machine/invoice_spec.rb +258 -0
  86. data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +51 -0
  87. data/spec/models/dorsale/billing_machine/quotation_spec.rb +213 -0
  88. data/spec/models/dorsale/billing_machine_spec.rb +57 -0
  89. data/spec/models/dorsale/comment_spec.rb +24 -0
  90. data/spec/models/dorsale/customer_vault/activity_type_spec.rb +10 -0
  91. data/spec/models/dorsale/customer_vault/corporation_spec.rb +33 -0
  92. data/spec/models/dorsale/customer_vault/event_spec.rb +22 -0
  93. data/spec/models/dorsale/customer_vault/individual_spec.rb +44 -0
  94. data/spec/models/dorsale/customer_vault/link_spec.rb +14 -0
  95. data/spec/models/dorsale/customer_vault/origin_spec.rb +8 -0
  96. data/spec/models/dorsale/customer_vault/person_spec.rb +112 -0
  97. data/spec/models/dorsale/email_spec.rb +39 -0
  98. data/spec/models/dorsale/expense_gun/category_spec.rb +9 -0
  99. data/spec/models/dorsale/expense_gun/expense_line_spec.rb +53 -0
  100. data/spec/models/dorsale/expense_gun/expense_spec.rb +176 -0
  101. data/spec/models/dorsale/flyboy/task_comment_spec.rb +54 -0
  102. data/spec/models/dorsale/flyboy/task_spec.rb +254 -0
  103. data/spec/models/dorsale/i18n_spec.rb +30 -0
  104. data/spec/models/dorsale/users_spec.rb +65 -0
  105. data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +42 -0
  106. data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +42 -0
  107. data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +42 -0
  108. data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +55 -0
  109. data/spec/pdfs/dorsale/expense_gun/expense_pdf_spec.rb +11 -0
  110. data/spec/rails_helper.rb +57 -0
  111. data/spec/routing/dorsale/alexandrie/attachments_routing_spec.rb +32 -0
  112. data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +67 -0
  113. data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +67 -0
  114. data/spec/routing/dorsale/comments_routing_spec.rb +23 -0
  115. data/spec/routing/dorsale/customer_vault/activity_types_routing_spec.rb +40 -0
  116. data/spec/routing/dorsale/customer_vault/events_routing_spec.rb +12 -0
  117. data/spec/routing/dorsale/customer_vault/origins_routing_spec.rb +40 -0
  118. data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +109 -0
  119. data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +62 -0
  120. data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +11 -0
  121. data/spec/routing/dorsale/flyboy/tasks_routing_spec.rb +51 -0
  122. data/spec/routing/dorsale/users_routing_spec.rb +38 -0
  123. data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +55 -0
  124. data/spec/services/dorsale/billing_machine/quotation/statistics.rb +23 -0
  125. data/spec/services/dorsale/billing_machine/quotation/to_invoice_spec.rb +46 -0
  126. data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +83 -0
  127. data/spec/services/dorsale/flyboy/task/copy_spec.rb +24 -0
  128. data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +117 -0
  129. data/spec/spec_helper.rb +86 -0
  130. data/spec/support/devise.rb +3 -0
  131. data/spec/support/message_delivery.rb +5 -0
  132. metadata +258 -2
@@ -0,0 +1,40 @@
1
+ require "rails_helper"
2
+
3
+ describe Dorsale::Flyboy::TaskCommentsController, type: :controller do
4
+ routes { Dorsale::Engine.routes }
5
+
6
+ let(:user) { create(:user) }
7
+
8
+ before(:each) { sign_in(user) }
9
+
10
+ let(:task) { create(:flyboy_task) }
11
+ let(:task_comment) { create(:flyboy_task_comment, task: task) }
12
+
13
+ describe "#create" do
14
+ let(:valid_params) { {task_id: task.id, task_comment: task_comment.attributes} }
15
+
16
+ it "should create the task_comment" do
17
+ post :create, params: valid_params
18
+ expect(assigns(:task_comment).persisted?).to be true
19
+ end
20
+
21
+ it "should redirect to referrer if referrer is task" do
22
+ url = flyboy_task_path(task) + "?sort=xxx"
23
+ request.env["HTTP_REFERER"] = url
24
+ post :create, params: valid_params
25
+ expect(response).to redirect_to url
26
+ end
27
+
28
+ it "should redirect to task if referrer is not task" do
29
+ url = "/anywhere"
30
+ request.env["HTTP_REFERER"] = url
31
+ post :create, params: valid_params
32
+ expect(response).to redirect_to flyboy_task_path(task)
33
+ end
34
+
35
+ it "should redirect to task if referrer is missing" do
36
+ post :create, params: valid_params
37
+ expect(response).to redirect_to flyboy_task_path(task)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,349 @@
1
+ require "rails_helper"
2
+
3
+ describe Dorsale::Flyboy::TasksController, type: :controller do
4
+ routes { Dorsale::Engine.routes }
5
+
6
+ let(:user) { create(:user) }
7
+
8
+ before(:each) { sign_in(user) }
9
+
10
+ let!(:task) {
11
+ create(:flyboy_task, done: false)
12
+ }
13
+
14
+ let(:valid_attributes) {
15
+ {
16
+ :name => "New Task",
17
+ :term => Date.current,
18
+ }
19
+ }
20
+
21
+ describe "#complete" do
22
+ before(:each) do
23
+ request.env["HTTP_REFERER"] = "where_i_came_from"
24
+ end
25
+
26
+ it "should mark the task as done" do
27
+ patch :complete, params: {id: task.id}
28
+ expect(task.reload.done).to be true
29
+ end
30
+
31
+ it "should set progress to 100" do
32
+ patch :complete, params: {id: task.id}
33
+ expect(task.reload.progress).to eq(100)
34
+ end
35
+
36
+ it "should add a task_comment" do
37
+ count = task.comments.count
38
+ patch :complete, params: {id: task.id}
39
+ expect(task.reload.comments.count).to eq(count+1)
40
+ expect(task.comments.last.progress).to eq(100)
41
+ end
42
+
43
+ it "should redirect to the referer page" do
44
+ patch :complete, params: {id: task.id}
45
+ expect(response).to redirect_to "where_i_came_from"
46
+ end
47
+ end
48
+
49
+ describe "GET index" do
50
+ context "when applying filter" do
51
+ before do
52
+ Dorsale::Flyboy::Task.destroy_all
53
+ @task1 = create(:flyboy_task, done: true)
54
+ @task2 = create(:flyboy_task, done: false)
55
+ end
56
+
57
+ it "should display both when not filtered" do
58
+ get :index
59
+ expect(assigns(:tasks).to_a.sort).to eq [@task1, @task2].sort
60
+ end
61
+
62
+ it "should filter by status closed" do
63
+ cookies["filters"] = {"fb_state" => "done"}.to_json
64
+ get :index
65
+ expect(assigns(:tasks).to_a).to eq [@task1]
66
+ end
67
+
68
+ it "should filter by status opened" do
69
+ cookies["filters"] = {"fb_state" => "undone"}.to_json
70
+ get :index
71
+ expect(assigns(:tasks).to_a).to eq [@task2]
72
+ end
73
+
74
+ it "should filter by tags" do
75
+ task1 = create(:flyboy_task, tag_list: "abc")
76
+ task2 = create(:flyboy_task, tag_list: "xyz")
77
+ cookies["filters"] = {fb_tags: ["abc"]}.to_json
78
+ get :index
79
+ expect(assigns(:tasks)).to eq [task1]
80
+ end
81
+ end
82
+
83
+ context "when sorting" do
84
+ before do
85
+ Dorsale::Flyboy::Task.destroy_all
86
+ @corporation1 = create(:customer_vault_corporation, name: "Abc")
87
+ @corporation2 = create(:customer_vault_corporation, name: "dEF")
88
+ @corporation3 = create(:customer_vault_corporation, name: "xyz")
89
+
90
+ @task1 = create(:flyboy_task,
91
+ :taskable => @corporation1,
92
+ :name => "Abc",
93
+ :progress => 100,
94
+ :term => "21/12/2012",
95
+ :reminder_type => "custom",
96
+ :reminder_date => "21/12/2012",
97
+ :tag_list => "aaa",
98
+ )
99
+
100
+ @task2 = create(:flyboy_task,
101
+ :taskable => @corporation2,
102
+ :name => "dEF",
103
+ :progress => 0,
104
+ :term => "23/12/2012",
105
+ :reminder_type => "custom",
106
+ :reminder_date => "23/12/2012",
107
+ :tag_list => "bbb",
108
+ )
109
+
110
+ @task3 = create(:flyboy_task,
111
+ :taskable => @corporation3,
112
+ :name => "xyz",
113
+ :progress => 35,
114
+ :term => "22/12/2012",
115
+ :reminder_type => "custom",
116
+ :reminder_date => "22/12/2012",
117
+ :tag_list => "",
118
+ )
119
+ end
120
+
121
+ it "sorting by taskable asc" do
122
+ get :index, params: {sort: "taskable"}
123
+ expect(assigns(:tasks).to_a).to eq [@task1, @task2, @task3]
124
+ end
125
+
126
+ it "sorting by taskable desc" do
127
+ get :index, params: {sort: "-taskable"}
128
+ expect(assigns(:tasks).to_a).to eq [@task3, @task2, @task1]
129
+ end
130
+
131
+ it "sorting by name asc" do
132
+ get :index, params: {sort: "name"}
133
+ expect(assigns(:tasks).to_a).to eq [@task1, @task2, @task3]
134
+ end
135
+
136
+ it "sorting by name desc" do
137
+ get :index, params: {sort: "-name"}
138
+ expect(assigns(:tasks).to_a).to eq [@task3, @task2, @task1]
139
+ end
140
+
141
+ it "sorting by progress asc" do
142
+ get :index, params: {sort: "progress"}
143
+ expect(assigns(:tasks).to_a).to eq [@task2, @task3, @task1]
144
+ end
145
+
146
+ it "sorting by progress desc" do
147
+ get :index, params: {sort: "-progress"}
148
+ expect(assigns(:tasks).to_a).to eq [@task1, @task3, @task2]
149
+ end
150
+
151
+ it "sorting by term asc" do
152
+ get :index, params: {sort: "term"}
153
+ expect(assigns(:tasks).to_a).to eq [@task1, @task3, @task2]
154
+ end
155
+
156
+ it "sorting by term desc" do
157
+ get :index, params: {sort: "-term"}
158
+ expect(assigns(:tasks).to_a).to eq [@task2, @task3, @task1]
159
+ end
160
+
161
+ it "sorting by tags asc" do
162
+ get :index, params: {sort: "tags"}
163
+ expect(assigns(:tasks).to_a).to eq [@task1, @task2, @task3]
164
+ end
165
+
166
+ it "sorting by tags desc" do
167
+ get :index, params: {sort: "-tags"}
168
+ expect(assigns(:tasks).to_a).to eq [@task3, @task2, @task1]
169
+ end
170
+ end
171
+ end
172
+
173
+ describe "GET show" do
174
+ it "assigns the requested task as @task" do
175
+ get :show, params: {:id => task.to_param}
176
+ expect(assigns(:task)).to eq(task)
177
+ end
178
+ end
179
+
180
+ describe "GET edit" do
181
+ it "assigns the requested task as @task" do
182
+ get :edit, params: {:id => task.to_param}
183
+ expect(assigns(:task)).to eq(task)
184
+ end
185
+ end
186
+
187
+ describe "POST create" do
188
+ describe "with valid params" do
189
+ it "creates a new Task" do
190
+ expect {
191
+ post :create, params: {:task => valid_attributes}
192
+ }.to change(Dorsale::Flyboy::Task, :count).by(1)
193
+ end
194
+
195
+ it "assigns a newly created task as @task" do
196
+ post :create, params: {:task => valid_attributes}
197
+ expect(assigns(:task)).to be_a(Dorsale::Flyboy::Task)
198
+ expect(assigns(:task)).to be_persisted
199
+ end
200
+
201
+ it "redirects to the created task" do
202
+ post :create, params: {:task => valid_attributes}
203
+ expect(response).to redirect_to Dorsale::Flyboy::Task.last_created
204
+ end
205
+
206
+ it "should send a mail to the owner" do
207
+ owner = create(:user)
208
+ ActionMailer::Base.deliveries.clear
209
+ post :create, params: {:task => valid_attributes.merge(owner_id: owner.id)}
210
+ expect(ActionMailer::Base.deliveries.count).to eq 1
211
+ email = ActionMailer::Base.deliveries.last
212
+ expect(email.to).to include owner.email
213
+ expect(email.subject).to include "New Task"
214
+ expect(email.body).to include @user.to_s
215
+ expect(email.body).to include "http://"
216
+ end
217
+
218
+ it "should not send a mail if there is no owner" do
219
+ ActionMailer::Base.deliveries.clear
220
+ post :create, params: {:task => valid_attributes}
221
+ expect(ActionMailer::Base.deliveries.count).to eq 0
222
+ end
223
+
224
+ it "should not send a mail if the author is the owner" do
225
+ ActionMailer::Base.deliveries.clear
226
+ post :create, params: {:task => valid_attributes}
227
+ expect(ActionMailer::Base.deliveries.count).to eq 0
228
+ end
229
+ end
230
+ end
231
+
232
+ describe "PUT update" do
233
+ let!(:task) { create(:flyboy_task) }
234
+
235
+ describe "with valid params" do
236
+ it "assigns the requested task as @task" do
237
+ patch :update, params: {id: task, task: valid_attributes}
238
+ expect(assigns(:task)).to eq(task)
239
+ end
240
+
241
+ it "redirects to the task" do
242
+ patch :update, params: {id: task, task: valid_attributes}
243
+ expect(response).to redirect_to(task)
244
+ end
245
+
246
+ it "should create term changed comment" do
247
+ valid_attributes[:term] = task.term - 3.days
248
+
249
+ expect {
250
+ patch :update, params: {id: task, task: valid_attributes}
251
+ }.to change(Dorsale::Flyboy::TaskComment, :count).by(1)
252
+ end
253
+ end
254
+
255
+ describe "with invalid params" do
256
+ it "assigns the task as @task" do
257
+ patch :update, params: {id: task, task: {name: nil}}
258
+ expect(assigns(:task)).to eq(task)
259
+ end
260
+ end
261
+ end
262
+
263
+ describe "DELETE destroy" do
264
+ it "destroys the requested task" do
265
+ task = create(:flyboy_task)
266
+ expect {
267
+ delete :destroy, params: {:id => task.to_param}
268
+ }.to change(Dorsale::Flyboy::Task, :count).by(-1)
269
+ end
270
+
271
+ it "redirects to the tasks list" do
272
+ task = create(:flyboy_task)
273
+ delete :destroy, params: {:id => task.to_param}
274
+ expect(response).to redirect_to(flyboy_tasks_path)
275
+ end
276
+ end
277
+
278
+ describe "snooze" do
279
+ it "should redirect to the task list to refresh it" do
280
+ task = create(:flyboy_task, term: 3.days.ago)
281
+ patch :snooze, params: {:id => task.to_param}
282
+ expect(response).to redirect_to(task)
283
+ end
284
+
285
+ it "is expected to create a task comment" do
286
+ task = create(:flyboy_task, term: 3.days.ago)
287
+ expect {
288
+ patch :snooze, params: {:id => task.to_param}
289
+ }.to change(Dorsale::Flyboy::TaskComment, :count).by(1)
290
+ end
291
+ end
292
+
293
+ describe "summary" do
294
+ let(:summary_user) { create :user }
295
+
296
+ before(:each) do
297
+ Dorsale::Flyboy::Task.destroy_all
298
+ sign_in summary_user
299
+
300
+ Timecop.freeze "2016-03-09 15:00:00"
301
+ @delayed_task = create(:flyboy_task, term: Date.yesterday) # tuesday
302
+ @today_task = create(:flyboy_task, term: Date.current) # thursday - today
303
+ @tomorrow_task = create(:flyboy_task, term: Date.tomorrow) # wednesday
304
+ @this_week_task = create(:flyboy_task, term: Date.parse("2016-03-12")) # sunday
305
+ @next_week_task = create(:flyboy_task, term: Date.parse("2016-03-14")) # monday next week
306
+ @next_next_week_task = create(:flyboy_task, term: Date.parse("2016-03-22")) # tuesday 2 weeks
307
+ end
308
+
309
+ it "should not assign tasks when owner is an other person" do
310
+ other_user = create(:user)
311
+ Dorsale::Flyboy::Task.update_all(owner_id: other_user.id)
312
+
313
+ Timecop.freeze "2016-03-09 15:00:00"
314
+ controller.setup_tasks_summary
315
+ expect(assigns(:delayed_tasks)).to eq []
316
+ expect(assigns(:today_tasks)).to eq []
317
+ expect(assigns(:tomorrow_tasks)).to eq []
318
+ expect(assigns(:this_week_tasks)).to eq []
319
+ expect(assigns(:next_week_tasks)).to eq []
320
+ expect(assigns(:next_next_week_tasks)).to eq []
321
+ end
322
+
323
+ it "should assign tasks when owner is nil" do
324
+ Dorsale::Flyboy::Task.update_all(owner_id: nil)
325
+
326
+ Timecop.freeze "2016-03-09 15:00:00"
327
+ controller.setup_tasks_summary
328
+ expect(assigns(:delayed_tasks)).to eq [@delayed_task]
329
+ expect(assigns(:today_tasks)).to eq [@today_task]
330
+ expect(assigns(:tomorrow_tasks)).to eq [@tomorrow_task]
331
+ expect(assigns(:this_week_tasks)).to eq [@this_week_task]
332
+ expect(assigns(:next_week_tasks)).to eq [@next_week_task]
333
+ expect(assigns(:next_next_week_tasks)).to eq [@next_next_week_task]
334
+ end
335
+
336
+ it "should assign tasks when owner is me" do
337
+ Dorsale::Flyboy::Task.update_all(owner_id: summary_user.id)
338
+
339
+ Timecop.freeze "2016-03-09 15:00:00"
340
+ controller.setup_tasks_summary
341
+ expect(assigns(:delayed_tasks)).to eq [@delayed_task]
342
+ expect(assigns(:today_tasks)).to eq [@today_task]
343
+ expect(assigns(:tomorrow_tasks)).to eq [@tomorrow_task]
344
+ expect(assigns(:this_week_tasks)).to eq [@this_week_task]
345
+ expect(assigns(:next_week_tasks)).to eq [@next_week_task]
346
+ expect(assigns(:next_next_week_tasks)).to eq [@next_next_week_task]
347
+ end
348
+ end # describe summary
349
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :alexandrie_attachment_type, class: ::Dorsale::Alexandrie::AttachmentType do
3
+ name { Faker::Lorem.words.join(" ") }
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ FactoryBot.define do
2
+ factory :alexandrie_attachment, class: ::Dorsale::Alexandrie::Attachment do
3
+ attachable {
4
+ DummyModel.create!(name: "abc")
5
+ }
6
+
7
+ sender {
8
+ create(:user)
9
+ }
10
+
11
+ file {
12
+ path = Dorsale::Engine.root.join("spec/files/pdf.pdf").to_s
13
+ Rack::Test::UploadedFile.new(path, "application/pdf")
14
+ }
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :billing_machine_invoice_line, class: ::Dorsale::BillingMachine::InvoiceLine do
3
+ invoice { create(:billing_machine_invoice) }
4
+ label { "Invoice line" + Faker::Lorem.words.join(" ") }
5
+ quantity { 10 }
6
+ unit { "€" }
7
+ unit_price { 20 }
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :billing_machine_invoice, class: ::Dorsale::BillingMachine::Invoice do
3
+ customer { create(:customer_vault_corporation) }
4
+ payment_term { create(:billing_machine_payment_term) }
5
+ date { "2014-02-19" }
6
+ label { "Software service" }
7
+ advance { 0 }
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :billing_machine_payment_term, class: ::Dorsale::BillingMachine::PaymentTerm do
3
+ label { "Payment term " + Faker::Lorem.words.join(" ") }
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :billing_machine_quotation_line, class: ::Dorsale::BillingMachine::QuotationLine do
3
+ quotation { create(:billing_machine_quotation) }
4
+ label { "Quotation line" + Faker::Lorem.words.join(" ") }
5
+ quantity { 10 }
6
+ unit { "€" }
7
+ unit_price { 20 }
8
+ end
9
+ end