dorsale 3.14.0 → 3.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebdaffde3d6482e50a41707f99a6e11672e92d70217bc78a53998597643c6f7a
4
- data.tar.gz: 89a6e804ec650c078e4fc40fdd88c2261e625c889c6125daee6dc90870ed66b2
3
+ metadata.gz: dad200bd30d5227629e98fbe51ae44e7858e4e7a4ee8239e7bbb5b7cd74ac329
4
+ data.tar.gz: 45c60aa2c41c120a78bd20e8c2badd457bf0a46e3f7fc92e3b50dac42ee71655
5
5
  SHA512:
6
- metadata.gz: 6c37a324dc797b8b2b0fabfe48c23a115d838b462fd54b7f6bde6548897a7e266983c0576c059cbf1694db245c0102de1725ef4b36c133b9d8ac98841b88c47d
7
- data.tar.gz: 21fdf0df6905f79ba1b0acac5d044723e50e15507a39729eea45578f7daf672ab1f4ec024aea193696156470772f3e35da1e9c59349e93a64b0d8042e4609e7c
6
+ metadata.gz: 5e41464b046478922d34ca0bba010e6a6015692f7edf997af4f09faacf7361eb3fc2c038ea06ea2e1f2e543881b153e31a3041bea6e989900663db3187e46ab9
7
+ data.tar.gz: a783ded1a2489e94aed2a133278507bb58eae5a336a3ea3f056f6aa6d2efb0fb9886297ee148100aa65470b598b9b686ec216a935215d9fe33fd838b28fc9e19
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 3.14.1
6
+ - "Task snoozed" comment improvements
7
+
5
8
  ## 3.14.0
6
9
  - Add `Dorsale::BillingMachine.vat_round_by_line` option
7
10
  - Revert default `vat_round_by_line` value introduced in 3.10.0 (it's now false again)
@@ -65,7 +65,9 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
65
65
  def update
66
66
  authorize @task, :update?
67
67
 
68
+ previous_term = @task.term
68
69
  if @task.update(task_params)
70
+ @task.create_term_changed_comment!(previous: previous_term, author: current_user)
69
71
  flash[:success] = t("messages.tasks.update_ok")
70
72
  redirect_to back_url
71
73
  else
@@ -107,14 +109,9 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
107
109
  def snooze
108
110
  authorize @task, :snooze?
109
111
 
112
+ previous_term = @task.term
110
113
  if @task.snoozer.snooze
111
- Dorsale::Flyboy::TaskComment.create!(
112
- :task => @task,
113
- :progress => @task.progress,
114
- :description => t("messages.tasks.snooze_ok"),
115
- :author => current_user,
116
- )
117
-
114
+ @task.create_term_changed_comment!(previous: previous_term, author: current_user)
118
115
  flash[:success] = t("messages.tasks.snooze_ok")
119
116
  else
120
117
  flash[:danger] = t("messages.tasks.snooze_error")
@@ -112,6 +112,19 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
112
112
  auto_update_reminder_date
113
113
  end
114
114
 
115
+ def create_term_changed_comment!(previous:, author:)
116
+ return if previous == term
117
+
118
+ old_date = H.date(previous)
119
+ new_date = H.date(term)
120
+
121
+ comments.create!(
122
+ :progress => progress,
123
+ :description => I18n.t("messages.tasks.snoozed", old_date: old_date, new_date: new_date),
124
+ :author => author,
125
+ )
126
+ end
127
+
115
128
  private
116
129
 
117
130
  def auto_update_reminder_date
@@ -11,6 +11,9 @@ en:
11
11
  snooze_eror: "One error occurs, task can't be snoozed"
12
12
  complete_ok: "Task completed"
13
13
  complete_eror: "One error occurs, task can't be completed"
14
+ copy_ok: "Task copied "
15
+ copy_ko: "One error occurs, task can't be copied"
16
+ snoozed: "Task term changed from %{old_date} to %{new_date}."
14
17
 
15
18
  task_mailer:
16
19
  new_task:
@@ -13,6 +13,7 @@ fr:
13
13
  complete_eror: "Impossible de terminer la tâche"
14
14
  copy_ok: "La tâche a été copiée"
15
15
  copy_ko: "Impossible de copier cette tâche"
16
+ snoozed: "L'échéance de la tâche a été modifiée de %{old_date} à %{new_date}."
16
17
 
17
18
  task_mailer:
18
19
  new_task:
@@ -22,7 +22,7 @@ Feature: Invoice Management
22
22
  Given 75 existing invoices
23
23
  When the user goes to the invoices page
24
24
  Then he should see 50 invoices
25
- When he goes to the next page
25
+ When he goes on the next page
26
26
  Then he should see 25 invoices
27
27
 
28
28
  Scenario: Copy invoice
@@ -22,7 +22,7 @@ Feature: Quotation Management
22
22
  Given 75 existing quotations
23
23
  When the user goes to the quotations page
24
24
  Then he should see 50 quotations
25
- When he goes to the next page
25
+ When he goes on the next page
26
26
  Then he should see 25 quotations
27
27
 
28
28
  Scenario: Empty quotation
@@ -41,7 +41,7 @@ Feature: Manage corporations
41
41
  Given 40 existing corporations
42
42
  When I go on the corporate index
43
43
  Then he can see 25 corporate
44
- When he go on the next page
44
+ When he goes on the next page
45
45
  Then he can see 15 corporate
46
46
 
47
47
  Scenario: New person without name
@@ -55,23 +55,23 @@ When(/^the user goes to the quotations page$/) do
55
55
  end
56
56
 
57
57
  When(/^the quotation line shows the right date$/) do
58
- page.should have_selector ".date", text: I18n.l(@quotation.date)
58
+ expect(page).to have_selector ".date", text: I18n.l(@quotation.date)
59
59
  end
60
60
 
61
61
  When(/^the quotation line shows the right traking\-id$/) do
62
- page.should have_selector ".tracking_id", text: @quotation.tracking_id
62
+ expect(page).to have_selector ".tracking_id", text: @quotation.tracking_id
63
63
  end
64
64
 
65
65
  When(/^the quotation line shows the right customer's name$/) do
66
- page.should have_selector ".customer_name", text: @customer.name
66
+ expect(page).to have_selector ".customer_name", text: @customer.name
67
67
  end
68
68
 
69
69
  When(/^the quotation line shows the right total excluding taxes value$/) do
70
- page.should have_selector ".total_excluding_taxes", text: "9,99 €"
70
+ expect(page).to have_selector ".total_excluding_taxes", text: "9,99 €"
71
71
  end
72
72
 
73
73
  When(/^the quotation line shows the right total including taxes value$/) do
74
- page.should have_selector ".total_including_taxes", text: "11,99 €"
74
+ expect(page).to have_selector ".total_including_taxes", text: "11,99 €"
75
75
  end
76
76
 
77
77
  When(/^the user goes to the quotation details$/) do
@@ -119,11 +119,11 @@ end
119
119
 
120
120
  Then(/^the document is not in the quotation details$/) do
121
121
  visit dorsale.billing_machine_quotation_path(@quotation)
122
- page.should have_link "pdf.pdf", count: 1
122
+ expect(page).to have_link "pdf.pdf", count: 1
123
123
  end
124
124
 
125
125
  Then(/^a message signals the success of the quotation update$/) do
126
- page.should have_selector ".alert-success"
126
+ expect(page).to have_selector ".alert-success"
127
127
  end
128
128
 
129
129
  Then(/^he fill the quotation commercial discount with "(.*?)"$/) do |arg1|
@@ -132,7 +132,7 @@ end
132
132
 
133
133
  Then(/^the quotation's label has changed$/) do
134
134
  visit dorsale.edit_billing_machine_quotation_path(@quotation)
135
- page.should have_field("quotation_label", with: @new_label)
135
+ expect(page).to have_field("quotation_label", with: @new_label)
136
136
  end
137
137
 
138
138
  Then(/^I am on the created quotation$/) do
@@ -145,11 +145,11 @@ Then(/^he can see all the quotation informations$/) do
145
145
  end
146
146
 
147
147
  Then(/^the quotation default date is set to today's date\.$/) do
148
- page.should have_field("quotation_date", with: I18n.l(Date.current))
148
+ expect(page).to have_field("quotation_date", with: I18n.l(Date.current))
149
149
  end
150
150
 
151
151
  Then(/^he should see (\d+) quotations?$/) do |arg1|
152
- page.should have_selector ".quotation", count: arg1
152
+ expect(page).to have_selector ".quotation", count: arg1
153
153
  end
154
154
 
155
155
  Then(/^the quotation is displayed correctly$/) do
@@ -157,11 +157,11 @@ Then(/^the quotation is displayed correctly$/) do
157
157
  end
158
158
 
159
159
  Then(/^a message signals the success of the quotation creation$/) do
160
- page.should have_selector ".alert-success"
160
+ expect(page).to have_selector ".alert-success"
161
161
  end
162
162
 
163
163
  Then(/^he will see links to the documents$/) do
164
- page.should have_link "pdf.pdf", count: 2
164
+ expect(page).to have_link "pdf.pdf", count: 2
165
165
  end
166
166
 
167
167
  Then(/^the quotation informations are visible on the quotation details$/) do
@@ -7,8 +7,9 @@ When(/^an existing customer$/) do
7
7
  @customer = create(:customer_vault_corporation)
8
8
  end
9
9
 
10
- When(/^he goes to the next page$/) do
10
+ When(/^he goes on the next page$/) do
11
11
  find(".next").click
12
+ expect(page).to have_selector ".page.active a[href$='2']"
12
13
  end
13
14
 
14
15
  Given(/^an existing payment term$/) do
@@ -42,16 +42,12 @@ When(/^I go on the corporate index$/) do
42
42
  visit dorsale.customer_vault_people_path
43
43
  end
44
44
 
45
- When(/^he go on the next page$/) do
46
- click_link "2"
47
- end
48
-
49
45
  Then(/^i see an error message for the missing name$/) do
50
46
  expect(page).to have_selector ".person_corporation_name.has-error"
51
47
  end
52
48
 
53
49
  Then(/^he can see (\d+) corporate$/) do |count|
54
- page.should have_selector ".person", count: count
50
+ expect(page).to have_selector ".person", count: count
55
51
  end
56
52
 
57
53
  Then(/^the corporation is created$/) do
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.14.0"
2
+ VERSION = "3.14.1"
3
3
  end
@@ -230,29 +230,31 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
230
230
  end
231
231
 
232
232
  describe "PUT update" do
233
+ let!(:task) { create(:flyboy_task) }
234
+
233
235
  describe "with valid params" do
234
236
  it "assigns the requested task as @task" do
235
- task = Dorsale::Flyboy::Task.create! valid_attributes
236
- patch :update, params: {:id => task.to_param, :task => valid_attributes}
237
+ patch :update, params: {id: task, task: valid_attributes}
237
238
  expect(assigns(:task)).to eq(task)
238
239
  end
239
240
 
240
241
  it "redirects to the task" do
241
- task = Dorsale::Flyboy::Task.create! valid_attributes
242
- patch :update, params: {:id => task.to_param, :task => valid_attributes}
242
+ patch :update, params: {id: task, task: valid_attributes}
243
243
  expect(response).to redirect_to(task)
244
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
245
253
  end
246
254
 
247
255
  describe "with invalid params" do
248
256
  it "assigns the task as @task" do
249
- task = Dorsale::Flyboy::Task.create! valid_attributes
250
-
251
- patch :update, params: {
252
- :id => task.to_param,
253
- :task => {:name => nil},
254
- }
255
-
257
+ patch :update, params: {id: task, task: {name: nil}}
256
258
  expect(assigns(:task)).to eq(task)
257
259
  end
258
260
  end
@@ -228,4 +228,27 @@ describe Dorsale::Flyboy::Task do
228
228
  expect(described_class.done).to eq [task_done]
229
229
  end
230
230
  end # describe "states"
231
+
232
+ describe "#create_term_changed_comment!" do
233
+ let!(:task) { create(:flyboy_task, term: "2019-10-02") }
234
+ let!(:author) { create(:user) }
235
+
236
+ it "should create comment" do
237
+ expect {
238
+ task.create_term_changed_comment!(previous: Date.new(2019, 10, 1), author: author)
239
+ }.to change(Dorsale::Flyboy::TaskComment, :count).by(1)
240
+
241
+ task_comment = task.comments.last_created
242
+ expect(task_comment.task).to eq task
243
+ expect(task_comment.author).to eq author
244
+ expect(task_comment.description).to eq \
245
+ "L'échéance de la tâche a été modifiée de 01/10/2019 à 02/10/2019."
246
+ end
247
+
248
+ it "should not create comment if date not changed" do
249
+ expect {
250
+ task.create_term_changed_comment!(previous: Date.new(2019, 10, 2), author: author)
251
+ }.to_not change(Dorsale::Flyboy::TaskComment, :count)
252
+ end
253
+ end # describe "#create_term_changed_comment!"
231
254
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorsale
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.0
4
+ version: 3.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails