dorsale 3.5.2 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Rakefile +12 -13
  4. data/app/assets/javascripts/dorsale/common/comments.coffee +7 -7
  5. data/app/assets/stylesheets/dorsale/common/comments.sass +1 -1
  6. data/app/assets/stylesheets/dorsale/engines/customer_vault.sass +22 -0
  7. data/app/assets/stylesheets/dorsale/engines/flyboy.sass +16 -0
  8. data/app/controllers/dorsale/comments_controller.rb +8 -1
  9. data/app/controllers/dorsale/customer_vault/people_controller.rb +12 -7
  10. data/app/controllers/dorsale/flyboy/tasks_controller.rb +6 -4
  11. data/app/helpers/dorsale/comments_helper.rb +7 -4
  12. data/app/helpers/dorsale/flyboy/application_helper.rb +49 -4
  13. data/app/helpers/dorsale/users_helper.rb +4 -0
  14. data/app/models/dorsale/comment.rb +1 -1
  15. data/app/models/dorsale/customer_vault/corporation.rb +2 -2
  16. data/app/models/dorsale/customer_vault/event.rb +28 -0
  17. data/app/models/dorsale/customer_vault/individual.rb +2 -2
  18. data/app/models/dorsale/customer_vault/person.rb +13 -0
  19. data/app/models/dorsale/flyboy/task.rb +45 -35
  20. data/app/policies/dorsale/customer_vault/event_policy_helper.rb +4 -0
  21. data/app/policies/dorsale/customer_vault/link_policy_helper.rb +1 -0
  22. data/app/policies/dorsale/flyboy/task_policy_helper.rb +1 -1
  23. data/app/policies/dorsale/policy_checker.rb +1 -0
  24. data/app/services/dorsale/flyboy/task/snoozer.rb +49 -0
  25. data/app/views/dorsale/comments/_comment.html.slim +3 -3
  26. data/app/views/dorsale/comments/_comments.html.slim +1 -1
  27. data/app/views/dorsale/comments/_form.html.slim +5 -2
  28. data/app/views/dorsale/comments/_list.html.slim +1 -1
  29. data/app/views/dorsale/customer_vault/events/_event.html.slim +24 -0
  30. data/app/views/dorsale/customer_vault/events/_list.html.slim +6 -0
  31. data/app/views/dorsale/customer_vault/people/activity.slim +3 -4
  32. data/app/views/dorsale/customer_vault/people/show.html.slim +2 -1
  33. data/app/views/dorsale/flyboy/tasks/_context.html.slim +1 -1
  34. data/app/views/dorsale/flyboy/tasks/_form.html.slim +10 -6
  35. data/app/views/dorsale/flyboy/tasks/_reminder_fields.html.slim +36 -0
  36. data/app/views/dorsale/flyboy/tasks/_term_fields.html.slim +20 -0
  37. data/config/locales/customer_vault.en.yml +10 -0
  38. data/config/locales/customer_vault.fr.yml +10 -0
  39. data/config/locales/flyboy.en.yml +21 -0
  40. data/config/locales/flyboy.fr.yml +21 -0
  41. data/db/migrate/20170413082819_dorsale_flyboy_tasks_new_reminder.rb +9 -0
  42. data/db/migrate/20170418070730_create_dorsale_customer_vault_events.rb +31 -0
  43. data/features/customer_vault_corporations.feature +1 -1
  44. data/features/flyboy_tasks.feature +34 -0
  45. data/features/step_definitions/common_steps.rb +25 -0
  46. data/features/step_definitions/customer_vault_corporations_steps.rb +7 -6
  47. data/features/step_definitions/flyboy_tasks_steps.rb +26 -18
  48. data/lib/dorsale/version.rb +1 -1
  49. data/spec/controllers/dorsale/comments_controller_spec.rb +15 -1
  50. data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +45 -7
  51. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +39 -44
  52. data/spec/factories/customer_vault_event.rb +7 -0
  53. data/spec/factories/dorsale_comments.rb +6 -0
  54. data/spec/factories/flyboy_tasks.rb +0 -2
  55. data/spec/helpers/dorsale/flyboy/application_helper_spec.rb +4 -4
  56. data/spec/models/dorsale/comment_spec.rb +12 -3
  57. data/spec/models/dorsale/customer_vault/corporation_spec.rb +1 -0
  58. data/spec/models/dorsale/customer_vault/event_spec.rb +23 -0
  59. data/spec/models/dorsale/customer_vault/individual_spec.rb +1 -0
  60. data/spec/models/dorsale/customer_vault/person_spec.rb +7 -7
  61. data/spec/models/dorsale/flyboy/task_spec.rb +69 -85
  62. data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +117 -0
  63. metadata +18 -3
@@ -50,6 +50,10 @@ fr:
50
50
  created_at: "Créée le"
51
51
  name: "Titre"
52
52
  reminder: "Rappel"
53
+ reminder_type: "Type de rappel"
54
+ reminder_date: "Date de rappel"
55
+ reminder_duration: "Durée du rappel"
56
+ reminder_unit: "Unité du rappel"
53
57
  term: "Echéance"
54
58
  done: "Fait"
55
59
  description: "Description"
@@ -59,3 +63,20 @@ fr:
59
63
  progress: "Progression"
60
64
  description: "Description"
61
65
  task: "Tâche"
66
+
67
+ dorsale/flyboy/task/reminder_type:
68
+ none: "Aucun"
69
+ duration: "Durée"
70
+ custom: "Date"
71
+
72
+ dorsale/flyboy/task/reminder_unit:
73
+ days: "Jour(s)"
74
+ weeks: "Semaine(s)"
75
+ months: "Mois"
76
+
77
+ dorsale/flyboy/task/term_value:
78
+ today: "Aujourd'hui"
79
+ tomorrow: "Demain"
80
+ this_week: "Cette semaine"
81
+ next_week: "La semaine prochaine"
82
+ custom: "Choisir une date"
@@ -0,0 +1,9 @@
1
+ class DorsaleFlyboyTasksNewReminder < ActiveRecord::Migration[5.0]
2
+ def change
3
+ rename_column :dorsale_flyboy_tasks, :reminder, :reminder_date
4
+ add_column :dorsale_flyboy_tasks, :reminder_type, :string
5
+ add_column :dorsale_flyboy_tasks, :reminder_duration, :integer
6
+ add_column :dorsale_flyboy_tasks, :reminder_unit, :string
7
+ Dorsale::Flyboy::Task.update_all(reminder_type: "custom")
8
+ end
9
+ end
@@ -0,0 +1,31 @@
1
+ class CreateDorsaleCustomerVaultEvents < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :dorsale_customer_vault_events do |t|
4
+ t.integer :author_id
5
+ t.integer :person_id
6
+ t.integer :comment_id
7
+ t.string :action
8
+ t.timestamps
9
+ end
10
+
11
+ Dorsale::CustomerVault::Person.all.each do |person|
12
+ event = Dorsale::CustomerVault::Event.new
13
+ event.person = person
14
+ event.action = "create"
15
+ event.created_at = person.created_at
16
+ event.updated_at = person.created_at
17
+ event.save(validate: false)
18
+ end
19
+
20
+ Dorsale::Comment.where(commentable_type: Dorsale::CustomerVault::Person.to_s).all.each do |comment|
21
+ event = Dorsale::CustomerVault::Event.new
22
+ event.author = comment.author
23
+ event.person = comment.commentable
24
+ event.comment = comment
25
+ event.action = "comment"
26
+ event.created_at = comment.created_at
27
+ event.updated_at = comment.created_at
28
+ event.save!
29
+ end
30
+ end
31
+ end
@@ -79,7 +79,7 @@ Feature: Manage corporations
79
79
  When I go on the people activity
80
80
  Then I see all these comments
81
81
 
82
- Scenario: People activity
82
+ Scenario: People activity pagination
83
83
  Given an existing corporation with 150 comments
84
84
  When I go on the people activity
85
85
  Then I see these comments paginated
@@ -86,3 +86,37 @@ Feature: Manage tasks
86
86
  Given a closed task with an owner
87
87
  When the flyboy daily crons run
88
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
@@ -63,3 +63,28 @@ end
63
63
  When(/^I click on show more$/) do
64
64
  find("a[class*=show_more]").click
65
65
  end
66
+
67
+ When(/^I select "([^"]*)"$/) do |value|
68
+ select value
69
+ end
70
+
71
+ When(/^I submit$/) do
72
+ find("#main [type=submit]").click
73
+ end
74
+
75
+ When(/^I fill "([^"]*)" with "([^"]*)"$/) do |field, value|
76
+ fill_in field, with: value
77
+ end
78
+
79
+ Then(/^"([^"]*)" has value "([^"]*)"$/) do |field, expected_value|
80
+ value = find_field(field).value
81
+ expect(value).to eq expected_value
82
+ end
83
+
84
+ Then(/^I do not see "([^"]*)" element$/) do |element_selector|
85
+ expect(page).to have_no_selector element_selector
86
+ end
87
+
88
+ Then(/^I see "([^"]*)" element$/) do |element_selector|
89
+ expect(page).to have_selector element_selector
90
+ end
@@ -105,14 +105,14 @@ end
105
105
 
106
106
  Given(/^an existing individual with recent comments$/) do
107
107
  @individual = create(:customer_vault_individual)
108
- @individual_comment1 = @individual.comments.create(text: "individual-comment-1", author: @user)
109
- @individual_comment2 = @individual.comments.create(text: "individual-comment-2", author: @user)
108
+ create(:dorsale_comment, commentable: @individual, text: "individual-comment-1")
109
+ create(:dorsale_comment, commentable: @individual, text: "individual-comment-2")
110
110
  end
111
111
 
112
112
  Given(/^an existing corporation with recent comments$/) do
113
113
  @corporation = create(:customer_vault_corporation)
114
- @corporation_comment1 = @corporation.comments.create(text: "corporation-comment-1", author: @user)
115
- @corporation_comment2 = @corporation.comments.create(text: "corporation-comment-2", author: @user)
114
+ create(:dorsale_comment, commentable: @corporation, text: "corporation-comment-1")
115
+ create(:dorsale_comment, commentable: @corporation, text: "corporation-comment-2")
116
116
  end
117
117
 
118
118
  When(/^I go on the people activity$/) do
@@ -127,9 +127,10 @@ Then(/^I see all these comments$/) do
127
127
  end
128
128
 
129
129
  Given(/^an existing corporation with (\d+) comments$/) do |n|
130
+ step "an existing corporation"
131
+
130
132
  n.to_i.times do
131
- @corporation = create(:customer_vault_corporation)
132
- @corporation.comments.create(text: "abc", author: @user)
133
+ create(:dorsale_comment, commentable: @corporation)
133
134
  end
134
135
  end
135
136
 
@@ -1,6 +1,3 @@
1
- # encoding: utf-8
2
- require "rake"
3
-
4
1
  Given(/^an existing done task$/) do
5
2
  @done_task = create(:flyboy_task, done: true)
6
3
  end
@@ -18,9 +15,8 @@ Given(/^an existing task$/) do
18
15
  end
19
16
 
20
17
  Given(/^an existing snoozable task$/) do
21
- create(:flyboy_task,
22
- :reminder => Date.yesterday,
23
- :term => Time.zone.now.to_date
18
+ @task = create(:flyboy_task,
19
+ :term => Time.zone.now.to_date,
24
20
  )
25
21
  end
26
22
 
@@ -32,27 +28,30 @@ end
32
28
 
33
29
  Given(/^a task with an owner that's the term is today$/) do
34
30
  @task = create(:flyboy_task,
35
- :reminder => Date.yesterday,
36
- :term => Time.zone.now.to_date,
37
- :owner => create(:user),
31
+ :term => Time.zone.now.to_date,
32
+ :reminder_type => "custom",
33
+ :reminder_date => Date.yesterday,
34
+ :owner => create(:user),
38
35
  )
39
36
  end
40
37
 
41
38
  Given(/^a task without owner$/) do
42
39
  @task = create(:flyboy_task,
43
- :reminder => Date.yesterday,
44
- :term => Time.zone.now.to_date,
45
- :owner => nil,
40
+ :term => Time.zone.now.to_date,
41
+ :reminder_type => "custom",
42
+ :reminder_date => Date.yesterday,
43
+ :owner => nil,
46
44
  )
47
45
  end
48
46
 
49
47
  Given(/^a closed task with an owner$/) do
50
48
  @task = create(:flyboy_task,
51
- :reminder => Date.yesterday,
52
- :term => Time.zone.now.to_date,
53
- :owner => create(:user),
54
- :progress => 100,
55
- :done => true,
49
+ :term => Time.zone.now.to_date,
50
+ :reminder_type => "custom",
51
+ :reminder_date => Date.yesterday,
52
+ :owner => create(:user),
53
+ :progress => 100,
54
+ :done => true,
56
55
  )
57
56
  end
58
57
 
@@ -147,7 +146,7 @@ Then(/^the task is completed$/) do
147
146
  end
148
147
 
149
148
  Then(/^the task is snoozed$/) do
150
- expect(all("a[href*=snooze]").count).to eq 0
149
+ expect(page).to have_no_selector "a[href*=snooze]"
151
150
  end
152
151
 
153
152
  Then(/^I am on this task$/) do
@@ -189,3 +188,12 @@ Then(/^the owner receive an email$/) do
189
188
  email = ActionMailer::Base.deliveries.last
190
189
  expect(email.to).to include @task.owner.email
191
190
  end
191
+
192
+ When(/^I go on the new task page$/) do
193
+ visit dorsale.new_flyboy_task_path
194
+ end
195
+
196
+ Then(/^selected task term is "([^"]*)"$/) do |expected_value|
197
+ value = find("#task_term option[selected]").text
198
+ expect(value).to eq expected_value
199
+ end
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.5.2"
2
+ VERSION = "3.6.0"
3
3
  end
@@ -7,8 +7,8 @@ describe Dorsale::CommentsController, type: :controller do
7
7
 
8
8
  before(:each) { sign_in(user) }
9
9
 
10
+ let(:commentable) { create(:customer_vault_corporation) }
10
11
  let(:valid_params){
11
- commentable = create(:customer_vault_corporation)
12
12
  {
13
13
  :comment => {
14
14
  :commentable_id => commentable.id,
@@ -29,6 +29,20 @@ describe Dorsale::CommentsController, type: :controller do
29
29
  post :create, params: valid_params
30
30
  expect(response).to redirect_to("/")
31
31
  end
32
+
33
+ describe "on person" do
34
+ it "should create an event" do
35
+ expect {
36
+ post :create, params: valid_params
37
+ }.to change(Dorsale::CustomerVault::Event, :count).by(1)
38
+
39
+ event = Dorsale::CustomerVault::Event.last_created
40
+ expect(event.author).to eq user
41
+ expect(event.person).to eq commentable
42
+ expect(event.comment).to eq Dorsale::Comment.last_created
43
+ expect(event.action).to eq "comment"
44
+ end
45
+ end # describe "on person"
32
46
  end
33
47
 
34
48
  describe "update" do
@@ -65,20 +65,58 @@ RSpec.describe ::Dorsale::CustomerVault::PeopleController, type: :controller do
65
65
  expect(assigns(:people)).to eq [corporation2]
66
66
  end
67
67
  end # describe "search"
68
- end # describe "#liwt"
68
+ end # describe "#list"
69
69
 
70
70
  describe "#activity" do
71
71
  before do
72
- @person = create(:customer_vault_corporation)
73
- @comment1 = @person.comments.create!(text: "ABC", created_at: Time.zone.now - 3.days, author: user)
74
- @comment2 = @person.comments.create!(text: "DEF", created_at: Time.zone.now - 2.days, author: user)
75
- @comment3 = @person.comments.create!(text: "DEF", created_at: Time.zone.now - 9.days, author: user)
72
+ @corporation_1 = create(:customer_vault_corporation)
73
+ @corporation_2 = create(:customer_vault_corporation)
74
+ @event_1 = create(:customer_vault_event, person: @corporation_1, created_at: "2012-02-15")
75
+ @event_2 = create(:customer_vault_event, person: @corporation_2, created_at: "2012-03-15")
76
76
  end
77
77
 
78
- it "should assigns all comments ordered by created_at DESC" do
78
+ it "should assigns all events ordered by created_at DESC" do
79
79
  get :activity
80
- expect(assigns(:comments)).to eq [@comment2, @comment1, @comment3]
80
+ expect(assigns(:events)).to eq [@event_2, @event_1]
81
81
  end
82
82
  end # describe "#activity"
83
83
 
84
+ describe "#create" do
85
+ before do
86
+ allow_any_instance_of(Dorsale::CustomerVault::PeopleController).to \
87
+ receive(:model) { Dorsale::CustomerVault::Corporation }
88
+ end
89
+
90
+ it "should generate an event" do
91
+ expect {
92
+ post :create, params: {person: {corporation_name: "agilidée"}}
93
+ }.to change(Dorsale::CustomerVault::Event, :count).by(1)
94
+
95
+ event = Dorsale::CustomerVault::Event.last_created
96
+ expect(event.author).to eq user
97
+ expect(event.person).to eq Dorsale::CustomerVault::Person.last_created
98
+ expect(event.action).to eq "create"
99
+ end
100
+ end # describe "#create"
101
+
102
+ describe "#update" do
103
+ before do
104
+ allow_any_instance_of(Dorsale::CustomerVault::PeopleController).to \
105
+ receive(:model) { Dorsale::CustomerVault::Corporation }
106
+ end
107
+
108
+ it "should generate an event" do
109
+ corporation = create(:customer_vault_corporation)
110
+
111
+ expect {
112
+ patch :update, params: {id: corporation, person: {corporation_name: "agilidée"}}
113
+ }.to change(Dorsale::CustomerVault::Event, :count).by(1)
114
+
115
+ event = Dorsale::CustomerVault::Event.last_created
116
+ expect(event.author).to eq user
117
+ expect(event.person).to eq corporation
118
+ expect(event.action).to eq "update"
119
+ end
120
+ end # describe "#update"
121
+
84
122
  end
@@ -12,9 +12,8 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
12
12
  }
13
13
 
14
14
  let(:valid_attributes) {{
15
- :name => "New Task" ,
16
- :reminder => (Time.zone.now.to_date - 3.days),
17
- :term => Time.zone.now.to_date,
15
+ :name => "New Task" ,
16
+ :term => Time.zone.now.to_date,
18
17
  }}
19
18
 
20
19
  describe "#complete" do
@@ -78,9 +77,9 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
78
77
  @corporation2 = create(:customer_vault_corporation, name: "dEF")
79
78
  @corporation3 = create(:customer_vault_corporation, name: "xyz")
80
79
 
81
- @task1 = create(:flyboy_task, taskable: @corporation1, name: "Abc", progress: 100, term: "21/12/2012", reminder: "21/12/2012")
82
- @task2 = create(:flyboy_task, taskable: @corporation2, name: "dEF", progress: 0, term: "23/12/2012", reminder: "23/12/2012")
83
- @task3 = create(:flyboy_task, taskable: @corporation3, name: "xyz", progress: 35, term: "22/12/2012", reminder: "22/12/2012")
80
+ @task1 = create(:flyboy_task, taskable: @corporation1, name: "Abc", progress: 100, term: "21/12/2012", reminder_type: "custom", reminder_date: "21/12/2012")
81
+ @task2 = create(:flyboy_task, taskable: @corporation2, name: "dEF", progress: 0, term: "23/12/2012", reminder_type: "custom", reminder_date: "23/12/2012")
82
+ @task3 = create(:flyboy_task, taskable: @corporation3, name: "xyz", progress: 35, term: "22/12/2012", reminder_type: "custom", reminder_date: "22/12/2012")
84
83
  end
85
84
 
86
85
  it "sorting by taskable asc" do
@@ -216,14 +215,14 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
216
215
 
217
216
  describe "DELETE destroy" do
218
217
  it "destroys the requested task" do
219
- task = Dorsale::Flyboy::Task.create! valid_attributes
218
+ task = create(:flyboy_task)
220
219
  expect {
221
220
  delete :destroy, params: {:id => task.to_param}
222
221
  }.to change(Dorsale::Flyboy::Task, :count).by(-1)
223
222
  end
224
223
 
225
224
  it "redirects to the tasks list" do
226
- task = Dorsale::Flyboy::Task.create! valid_attributes
225
+ task = create(:flyboy_task)
227
226
  delete :destroy, params: {:id => task.to_param}
228
227
  expect(response).to redirect_to(flyboy_tasks_path)
229
228
  end
@@ -231,7 +230,7 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
231
230
 
232
231
  describe "snooze" do
233
232
  it "should redirect to the task list to refresh it" do
234
- task = Dorsale::Flyboy::Task.create! valid_attributes
233
+ task = create(:flyboy_task, term: 3.days.ago)
235
234
  patch :snooze, params: {:id => task.to_param}
236
235
  expect(response).to redirect_to(task)
237
236
  end
@@ -244,57 +243,53 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
244
243
  Dorsale::Flyboy::Task.destroy_all
245
244
  sign_in summary_user
246
245
 
247
- Timecop.travel "2016-03-09 15:00:00" do
248
- @delayed_task = create(:flyboy_task, term: Date.yesterday) # tuesday
249
- @today_task = create(:flyboy_task, term: Time.zone.now.to_date) # thursday - today
250
- @tomorrow_task = create(:flyboy_task, term: Date.tomorrow) # wednesday
251
- @this_week_task = create(:flyboy_task, term: Date.parse("2016-03-12")) # sunday
252
- @next_week_task = create(:flyboy_task, term: Date.parse("2016-03-14")) # monday next week
253
- @next_next_week_task = create(:flyboy_task, term: Date.parse("2016-03-22")) # tuesday next next week
254
- end
246
+ Timecop.freeze "2016-03-09 15:00:00"
247
+ @delayed_task = create(:flyboy_task, term: Date.yesterday) # tuesday
248
+ @today_task = create(:flyboy_task, term: Time.zone.now.to_date) # thursday - today
249
+ @tomorrow_task = create(:flyboy_task, term: Date.tomorrow) # wednesday
250
+ @this_week_task = create(:flyboy_task, term: Date.parse("2016-03-12")) # sunday
251
+ @next_week_task = create(:flyboy_task, term: Date.parse("2016-03-14")) # monday next week
252
+ @next_next_week_task = create(:flyboy_task, term: Date.parse("2016-03-22")) # tuesday next next week
255
253
  end
256
254
 
257
255
  it "should not assign tasks when owner is an other person" do
258
256
  other_user = create(:user)
259
257
  Dorsale::Flyboy::Task.update_all(owner_id: other_user.id, owner_type: other_user.class)
260
258
 
261
- Timecop.travel "2016-03-09 15:00:00" do
262
- controller.setup_tasks_summary
263
- expect(assigns(:delayed_tasks)).to eq []
264
- expect(assigns(:today_tasks)).to eq []
265
- expect(assigns(:tomorrow_tasks)).to eq []
266
- expect(assigns(:this_week_tasks)).to eq []
267
- expect(assigns(:next_week_tasks)).to eq []
268
- expect(assigns(:next_next_week_tasks)).to eq []
269
- end
259
+ Timecop.freeze "2016-03-09 15:00:00"
260
+ controller.setup_tasks_summary
261
+ expect(assigns(:delayed_tasks)).to eq []
262
+ expect(assigns(:today_tasks)).to eq []
263
+ expect(assigns(:tomorrow_tasks)).to eq []
264
+ expect(assigns(:this_week_tasks)).to eq []
265
+ expect(assigns(:next_week_tasks)).to eq []
266
+ expect(assigns(:next_next_week_tasks)).to eq []
270
267
  end
271
268
 
272
269
  it "should assign tasks when owner is nil" do
273
270
  Dorsale::Flyboy::Task.update_all(owner_id: nil, owner_type: nil)
274
271
 
275
- Timecop.travel "2016-03-09 15:00:00" do
276
- controller.setup_tasks_summary
277
- expect(assigns(:delayed_tasks)).to eq [@delayed_task]
278
- expect(assigns(:today_tasks)).to eq [@today_task]
279
- expect(assigns(:tomorrow_tasks)).to eq [@tomorrow_task]
280
- expect(assigns(:this_week_tasks)).to eq [@this_week_task]
281
- expect(assigns(:next_week_tasks)).to eq [@next_week_task]
282
- expect(assigns(:next_next_week_tasks)).to eq [@next_next_week_task]
283
- end
272
+ Timecop.freeze "2016-03-09 15:00:00"
273
+ controller.setup_tasks_summary
274
+ expect(assigns(:delayed_tasks)).to eq [@delayed_task]
275
+ expect(assigns(:today_tasks)).to eq [@today_task]
276
+ expect(assigns(:tomorrow_tasks)).to eq [@tomorrow_task]
277
+ expect(assigns(:this_week_tasks)).to eq [@this_week_task]
278
+ expect(assigns(:next_week_tasks)).to eq [@next_week_task]
279
+ expect(assigns(:next_next_week_tasks)).to eq [@next_next_week_task]
284
280
  end
285
281
 
286
282
  it "should assign tasks when owner is me" do
287
283
  Dorsale::Flyboy::Task.update_all(owner_id: summary_user.id, owner_type: summary_user.class)
288
284
 
289
- Timecop.travel "2016-03-09 15:00:00" do
290
- controller.setup_tasks_summary
291
- expect(assigns(:delayed_tasks)).to eq [@delayed_task]
292
- expect(assigns(:today_tasks)).to eq [@today_task]
293
- expect(assigns(:tomorrow_tasks)).to eq [@tomorrow_task]
294
- expect(assigns(:this_week_tasks)).to eq [@this_week_task]
295
- expect(assigns(:next_week_tasks)).to eq [@next_week_task]
296
- expect(assigns(:next_next_week_tasks)).to eq [@next_next_week_task]
297
- end
285
+ Timecop.freeze "2016-03-09 15:00:00"
286
+ controller.setup_tasks_summary
287
+ expect(assigns(:delayed_tasks)).to eq [@delayed_task]
288
+ expect(assigns(:today_tasks)).to eq [@today_task]
289
+ expect(assigns(:tomorrow_tasks)).to eq [@tomorrow_task]
290
+ expect(assigns(:this_week_tasks)).to eq [@this_week_task]
291
+ expect(assigns(:next_week_tasks)).to eq [@next_week_task]
292
+ expect(assigns(:next_next_week_tasks)).to eq [@next_next_week_task]
298
293
  end
299
294
 
300
295
  end # describe summary