dorsale 3.8.1 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +5 -1
- data/app/commands/dorsale/flyboy/task_commands.rb +1 -1
- data/app/controllers/concerns/dorsale/flyboy/tasks_summary_concern.rb +0 -1
- data/app/controllers/dorsale/alexandrie/attachments_controller.rb +1 -2
- data/app/controllers/dorsale/application_controller.rb +0 -1
- data/app/controllers/dorsale/billing_machine/application_controller.rb +0 -2
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +9 -22
- data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +0 -1
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +1 -4
- data/app/controllers/dorsale/comments_controller.rb +3 -2
- data/app/controllers/dorsale/customer_vault/activity_types_controller.rb +0 -1
- data/app/controllers/dorsale/customer_vault/application_controller.rb +0 -1
- data/app/controllers/dorsale/customer_vault/links_controller.rb +22 -12
- data/app/controllers/dorsale/customer_vault/origins_controller.rb +0 -1
- data/app/controllers/dorsale/customer_vault/people_controller.rb +2 -3
- data/app/controllers/dorsale/expense_gun/categories_controller.rb +0 -1
- data/app/controllers/dorsale/expense_gun/expenses_controller.rb +0 -1
- data/app/controllers/dorsale/flyboy/task_comments_controller.rb +0 -1
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +28 -21
- data/app/controllers/dorsale/users_controller.rb +0 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +9 -5
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb +2 -2
- data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
- data/app/helpers/dorsale/billing_machine/application_helper.rb +6 -6
- data/app/helpers/dorsale/context_helper.rb +1 -1
- data/app/helpers/dorsale/flyboy/application_helper.rb +4 -5
- data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +0 -1
- data/app/mailers/dorsale/flyboy/task_mailer.rb +0 -1
- data/app/mailers/dorsale/user_mailer.rb +0 -1
- data/app/models/dorsale/address.rb +2 -2
- data/app/models/dorsale/alexandrie/attachment_type.rb +0 -1
- data/app/models/dorsale/billing_machine.rb +1 -2
- data/app/models/dorsale/billing_machine/invoice.rb +19 -30
- data/app/models/dorsale/billing_machine/invoice_line.rb +2 -2
- data/app/models/dorsale/billing_machine/quotation.rb +11 -17
- data/app/models/dorsale/billing_machine/quotation_line.rb +2 -3
- data/app/models/dorsale/comment.rb +1 -1
- data/app/models/dorsale/customer_vault/corporation.rb +11 -10
- data/app/models/dorsale/customer_vault/event.rb +2 -2
- data/app/models/dorsale/customer_vault/individual.rb +4 -2
- data/app/models/dorsale/customer_vault/person.rb +14 -4
- data/app/models/dorsale/customer_vault/person_data.rb +1 -2
- data/app/models/dorsale/expense_gun/expense.rb +2 -5
- data/app/models/dorsale/expense_gun/expense_line.rb +2 -2
- data/app/models/dorsale/flyboy/task.rb +17 -18
- data/app/models/dorsale/flyboy/task_comment.rb +1 -1
- data/app/models/dorsale/users/active.rb +1 -1
- data/app/models/dorsale/users/avatar.rb +2 -1
- data/app/models/dorsale/users/password_generation.rb +0 -1
- data/app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb +1 -1
- data/app/pdfs/dorsale/application_pdf.rb +7 -0
- data/app/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf.rb +52 -47
- data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +94 -205
- data/app/pdfs/dorsale/prawn_helpers.rb +107 -0
- data/app/policies/dorsale/application_policy.rb +2 -4
- data/app/policies/dorsale/expense_gun/expense_policy_helper.rb +0 -1
- data/app/policies/dorsale/flyboy/task_policy_helper.rb +3 -3
- data/app/policies/dorsale/policy_checker.rb +11 -18
- data/app/services/dorsale/billing_machine/invoice/copy.rb +2 -2
- data/app/services/dorsale/billing_machine/pdf_file_generator.rb +7 -2
- data/app/services/dorsale/billing_machine/quotation/copy.rb +1 -1
- data/app/services/dorsale/billing_machine/quotation/to_invoice.rb +10 -7
- data/app/services/dorsale/flyboy/task/snoozer.rb +1 -1
- data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -2
- data/app/views/dorsale/billing_machine/invoices/_form.html.slim +4 -11
- data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +1 -1
- data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +1 -1
- data/config/locales/alexandrie.en.yml +0 -4
- data/config/locales/alexandrie.fr.yml +0 -4
- data/config/locales/billing_machine.en.yml +0 -41
- data/config/locales/billing_machine.fr.yml +0 -41
- data/config/routes.rb +0 -1
- data/db/migrate/20161119064536_delete_id_cards.rb +9 -0
- data/features/billing_machine_invoices.feature +0 -1
- data/features/billing_machine_multiple_vat.feature +0 -1
- data/features/billing_machine_quotations.feature +0 -1
- data/features/step_definitions/billing_machine_invoices_steps.rb +73 -79
- data/features/step_definitions/billing_machine_multiple_vat.rb +5 -6
- data/features/step_definitions/billing_machine_payment_terms_steps.rb +2 -2
- data/features/step_definitions/billing_machine_quotations_steps.rb +45 -80
- data/features/step_definitions/common_steps.rb +0 -4
- data/features/step_definitions/customer_vault_activity_types_steps.rb +1 -1
- data/features/step_definitions/customer_vault_corporations_steps.rb +27 -23
- data/features/step_definitions/customer_vault_individuals_steps.rb +8 -9
- data/features/step_definitions/customer_vault_invoices_steps.rb +1 -1
- data/features/step_definitions/customer_vault_links_steps.rb +6 -6
- data/features/step_definitions/customer_vault_origins_steps.rb +1 -1
- data/features/step_definitions/customer_vault_people_steps.rb +2 -1
- data/features/step_definitions/expense_gun_categories_steps.rb +2 -2
- data/features/step_definitions/expense_gun_expenses_steps.rb +6 -6
- data/features/step_definitions/flyboy_tasks_steps.rb +4 -7
- data/features/step_definitions/tasks_summary_steps.rb +3 -3
- data/features/support/env.rb +3 -2
- data/lib/dorsale/engine.rb +8 -8
- data/lib/dorsale/file_loader.rb +1 -1
- data/lib/dorsale/simple_form.rb +3 -3
- data/lib/dorsale/simple_form_bootstrap.rb +46 -46
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +3 -3
- data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +0 -1
- data/spec/controllers/dorsale/comments_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +9 -9
- data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +15 -19
- data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +1 -2
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +43 -19
- data/spec/factories/alexandrie_attachment_types.rb +1 -1
- data/spec/factories/alexandrie_attachments.rb +1 -1
- data/spec/factories/billing_machine_invoice_lines.rb +1 -1
- data/spec/factories/billing_machine_invoices.rb +1 -2
- data/spec/factories/billing_machine_payment_terms.rb +1 -1
- data/spec/factories/billing_machine_quotation_lines.rb +1 -2
- data/spec/factories/billing_machine_quotations.rb +1 -2
- data/spec/factories/customer_vault_activity_types.rb +1 -1
- data/spec/factories/customer_vault_corporations.rb +1 -1
- data/spec/factories/customer_vault_event.rb +1 -1
- data/spec/factories/customer_vault_individuals.rb +2 -2
- data/spec/factories/customer_vault_links.rb +1 -1
- data/spec/factories/customer_vault_origins.rb +1 -1
- data/spec/factories/dorsale_addresses.rb +1 -1
- data/spec/factories/dorsale_comments.rb +1 -1
- data/spec/factories/expense_gun_categories.rb +2 -2
- data/spec/factories/expense_gun_expense_lines.rb +8 -8
- data/spec/factories/expense_gun_expenses.rb +2 -3
- data/spec/factories/flyboy_task_comments.rb +1 -1
- data/spec/factories/flyboy_tasks.rb +1 -1
- data/spec/mailers/user_mailer.rb +5 -6
- data/spec/models/dorsale/address_spec.rb +26 -26
- data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +6 -6
- data/spec/models/dorsale/billing_machine/invoice_spec.rb +37 -23
- data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +9 -10
- data/spec/models/dorsale/billing_machine/quotation_spec.rb +26 -28
- data/spec/models/dorsale/billing_machine_spec.rb +0 -1
- data/spec/models/dorsale/comment_spec.rb +0 -1
- data/spec/models/dorsale/customer_vault/corporation_spec.rb +20 -20
- data/spec/models/dorsale/customer_vault/event_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/individual_spec.rb +0 -2
- data/spec/models/dorsale/customer_vault/link_spec.rb +0 -1
- data/spec/models/dorsale/customer_vault/person_spec.rb +7 -6
- data/spec/models/dorsale/expense_gun/category_spec.rb +2 -2
- data/spec/models/dorsale/expense_gun/expense_line_spec.rb +14 -14
- data/spec/models/dorsale/expense_gun/expense_spec.rb +23 -13
- data/spec/models/dorsale/flyboy/task_comment_spec.rb +5 -6
- data/spec/models/dorsale/flyboy/task_spec.rb +66 -42
- data/spec/models/dorsale/users_spec.rb +3 -5
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +6 -11
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +7 -11
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +6 -11
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +7 -14
- data/spec/rails_helper.rb +1 -1
- data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +0 -1
- data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +0 -1
- data/spec/routing/dorsale/comments_routing_spec.rb +0 -2
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +0 -1
- data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +0 -1
- data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +0 -1
- data/spec/routing/dorsale/users_routing_spec.rb +1 -1
- data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +2 -2
- data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +13 -17
- data/spec/services/dorsale/flyboy/task/copy_spec.rb +1 -2
- data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -0
- metadata +5 -43
- data/app/controllers/dorsale/billing_machine/id_cards_controller.rb +0 -106
- data/app/models/dorsale/billing_machine/id_card.rb +0 -14
- data/app/policies/dorsale/billing_machine/id_card_policy_helper.rb +0 -7
- data/app/views/dorsale/billing_machine/id_cards/_form.html.slim +0 -42
- data/app/views/dorsale/billing_machine/id_cards/_index_actions.html.slim +0 -2
- data/app/views/dorsale/billing_machine/id_cards/_list.html.slim +0 -27
- data/app/views/dorsale/billing_machine/id_cards/edit.html.slim +0 -1
- data/app/views/dorsale/billing_machine/id_cards/index.html.slim +0 -11
- data/app/views/dorsale/billing_machine/id_cards/new.html.slim +0 -1
- data/features/billing_machine_id_cards.feature +0 -19
- data/features/step_definitions/billing_machine_id_cards_steps.rb +0 -53
- data/features/support/ajax.rb +0 -20
- data/features/support/database_cleaner.rb +0 -12
- data/features/support/factory_girl.rb +0 -1
- data/features/support/fix_referrer.rb +0 -9
- data/features/support/message_delivery.rb +0 -1
- data/features/support/poltergeist.rb +0 -22
- data/features/support/rails.rb +0 -1
- data/features/support/rspec.rb +0 -6
- data/features/support/screenshots.rb +0 -5
- data/features/support/sign_in.rb +0 -17
- data/features/support/simplecov.rb +0 -1
- data/features/support/turbolinks.rb +0 -30
- data/spec/factories/billing_machine_id_cards.rb +0 -26
- data/spec/models/dorsale/billing_machine/id_card_spec.rb +0 -12
data/config/routes.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
class DeleteIdCards < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
# Comment this migration or only this line to keep or delete id cards
|
4
|
+
raise "Hi ! Do you want to delete id cards ?"
|
5
|
+
drop_table :dorsale_billing_machine_id_cards
|
6
|
+
remove_column :dorsale_billing_machine_invoices, :id_card_id
|
7
|
+
remove_column :dorsale_billing_machine_quotations, :id_card_id
|
8
|
+
end
|
9
|
+
end
|
@@ -1,25 +1,25 @@
|
|
1
1
|
Given(/^an existing emtpy invoice$/) do
|
2
|
-
@invoice = create(:billing_machine_invoice, label: nil, customer: nil, payment_term_id: nil
|
2
|
+
@invoice = create(:billing_machine_invoice, label: nil, customer: nil, payment_term_id: nil)
|
3
3
|
@invoice.due_date = nil
|
4
4
|
@invoice.save
|
5
5
|
end
|
6
6
|
|
7
7
|
Given(/^(\d+) existing invoices$/) do |count|
|
8
|
-
create_list(:billing_machine_invoice, count.to_i
|
8
|
+
create_list(:billing_machine_invoice, count.to_i)
|
9
9
|
end
|
10
10
|
|
11
11
|
Given(/^an existing invoice$/) do
|
12
|
-
@invoice = create(:billing_machine_invoice,
|
12
|
+
@invoice = create(:billing_machine_invoice, customer: @customer)
|
13
13
|
@invoice.lines.create(quantity: 1, unit_price: 9.99)
|
14
14
|
end
|
15
15
|
|
16
16
|
Given(/^an existing invoice with a "(.*?)"% VAT rate$/) do |rate|
|
17
|
-
@invoice = create(:billing_machine_invoice
|
17
|
+
@invoice = create(:billing_machine_invoice)
|
18
18
|
create(:billing_machine_invoice_line, vat_rate: rate, invoice: @invoice)
|
19
19
|
end
|
20
20
|
|
21
21
|
Given(/^an existing paid invoice$/) do
|
22
|
-
@invoice = create(:billing_machine_invoice,
|
22
|
+
@invoice = create(:billing_machine_invoice, paid: true)
|
23
23
|
end
|
24
24
|
|
25
25
|
Given(/^billing machine in single vat mode$/) do
|
@@ -27,57 +27,51 @@ Given(/^billing machine in single vat mode$/) do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
Given(/^a bunch of existing invoices$/) do
|
30
|
-
c1 = create(:customer_vault_corporation, name:
|
31
|
-
c2 = create(:customer_vault_corporation, name:
|
32
|
-
c3 = create(:customer_vault_corporation, name:
|
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
33
|
|
34
|
-
i1 = create(:customer_vault_individual, first_name:
|
35
|
-
i2 = create(:customer_vault_individual, first_name:
|
36
|
-
i3 = create(:customer_vault_individual, first_name:
|
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
37
|
|
38
|
-
create(:billing_machine_invoice,
|
39
|
-
create(:billing_machine_invoice,
|
40
|
-
create(:billing_machine_invoice,
|
41
|
-
create(:billing_machine_invoice,
|
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
42
|
|
43
|
-
create(:billing_machine_invoice,
|
44
|
-
create(:billing_machine_invoice,
|
45
|
-
create(:billing_machine_invoice,
|
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
46
|
end
|
47
47
|
|
48
48
|
Given(/^an existing unpaid invoice$/) do
|
49
|
-
@invoice = create(:billing_machine_invoice,
|
49
|
+
@invoice = create(:billing_machine_invoice, paid: false)
|
50
50
|
end
|
51
51
|
|
52
52
|
Given(/^its due date is not yet passed$/) do
|
53
|
-
@invoice.update!(due_date: (
|
53
|
+
@invoice.update!(due_date: (Date.current + 1))
|
54
54
|
end
|
55
55
|
|
56
56
|
Given(/^its due date is the same day$/) do
|
57
|
-
@invoice.update!(due_date:
|
57
|
+
@invoice.update!(due_date: Date.current)
|
58
58
|
end
|
59
59
|
|
60
60
|
Given(/^its due date is yesterday$$/) do
|
61
|
-
@invoice.update!(due_date: (
|
61
|
+
@invoice.update!(due_date: (Date.current - 1))
|
62
62
|
end
|
63
63
|
|
64
64
|
Given(/^its due date is (\d+) days ago$/) do |days|
|
65
|
-
@invoice.update!(due_date: (
|
65
|
+
@invoice.update!(due_date: (Date.current - days.to_i))
|
66
66
|
end
|
67
67
|
|
68
68
|
Given(/^existing "(.*?)" invoices with "(.*?)" amount$/) do |n, amount|
|
69
69
|
n.to_i.times do
|
70
|
-
|
71
|
-
invoice_line = create(:billing_machine_invoice_line,
|
72
|
-
invoice: invoice,
|
73
|
-
quantity: 1,
|
74
|
-
unit_price: amount,
|
75
|
-
total: nil
|
76
|
-
)
|
70
|
+
create(:billing_machine_invoice_line, quantity: 1, unit_price: amount)
|
77
71
|
end
|
78
72
|
end
|
79
73
|
|
80
|
-
When(/^(the user|he) goes to the invoices page$/) do
|
74
|
+
When(/^(?:the user|he) goes to the invoices page$/) do
|
81
75
|
visit dorsale.billing_machine_invoices_path
|
82
76
|
end
|
83
77
|
|
@@ -86,9 +80,9 @@ When(/^he creates a new invoice$/) do
|
|
86
80
|
end
|
87
81
|
|
88
82
|
When(/^he fills the reference, the date, the vat rate and the payment terms$/) do
|
89
|
-
fill_in
|
90
|
-
fill_in
|
91
|
-
fill_in
|
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"
|
92
86
|
select @payment_term.label
|
93
87
|
end
|
94
88
|
|
@@ -107,10 +101,10 @@ end
|
|
107
101
|
When(/^he fills a line with "(.*?)", "(.*?)", "(.*?)", "(.*?)"$/) do |label, quantity, unit, unit_price|
|
108
102
|
expect(page).to have_selector(".line")
|
109
103
|
|
110
|
-
within all(
|
104
|
+
within all(".line").last do
|
111
105
|
find(".line-label textarea").set label
|
112
|
-
find(".line-quantity input").set
|
113
|
-
find(".line-unit input").set
|
106
|
+
find(".line-quantity input").set quantity
|
107
|
+
find(".line-unit input").set unit
|
114
108
|
find(".line-unit_price input").set unit_price
|
115
109
|
end
|
116
110
|
end
|
@@ -121,19 +115,19 @@ end
|
|
121
115
|
|
122
116
|
When(/^changes the label$/) do
|
123
117
|
@new_label= @invoice.label + " Edited"
|
124
|
-
fill_in
|
118
|
+
fill_in "invoice_label", with: @new_label
|
125
119
|
end
|
126
120
|
|
127
121
|
When(/^he changes the VAT rate to "(.*?)"$/) do |new_rate|
|
128
|
-
fill_in
|
122
|
+
fill_in "invoice_vat_rate", with: new_rate
|
129
123
|
end
|
130
124
|
|
131
125
|
When(/^he changes the commercial discount to "(.*?)"€$/) do |arg1|
|
132
|
-
fill_in
|
126
|
+
fill_in "invoice_commercial_discount", with: arg1
|
133
127
|
end
|
134
128
|
|
135
129
|
When(/^he adds a new line$/) do
|
136
|
-
click_link
|
130
|
+
click_link "add-new-line"
|
137
131
|
end
|
138
132
|
|
139
133
|
When(/^he saves the invoice$/) do
|
@@ -145,13 +139,13 @@ When(/^he set the invoice as paid$/) do
|
|
145
139
|
end
|
146
140
|
|
147
141
|
When(/^he marks the invoice as unpaid$/) do
|
148
|
-
within
|
149
|
-
select
|
142
|
+
within ".form-group.select.invoice_paid" do
|
143
|
+
select "No"
|
150
144
|
end
|
151
145
|
end
|
152
146
|
|
153
147
|
When(/^he changes the advance to "(.*?)"€$/) do |value|
|
154
|
-
fill_in
|
148
|
+
fill_in "invoice_advance", with: value
|
155
149
|
end
|
156
150
|
|
157
151
|
When(/^he goes to the newly created invoice page$/) do
|
@@ -165,15 +159,15 @@ When(/^he filters by date on today$/) do
|
|
165
159
|
end
|
166
160
|
|
167
161
|
When(/^he filters by one customer$/) do
|
168
|
-
within(
|
169
|
-
select(
|
162
|
+
within(".filters") do
|
163
|
+
select("Bidule")
|
170
164
|
find(".filter-submit").click
|
171
165
|
end
|
172
166
|
end
|
173
167
|
|
174
168
|
When(/^he filters by status on paid$/) do
|
175
|
-
within(
|
176
|
-
select(
|
169
|
+
within(".filters") do
|
170
|
+
select("Payée")
|
177
171
|
find(".filter-submit").click
|
178
172
|
end
|
179
173
|
end
|
@@ -184,11 +178,11 @@ When(/^the user download the pdf$/) do
|
|
184
178
|
end
|
185
179
|
|
186
180
|
Then(/^he should see (\d+) invoices?$/) do |count|
|
187
|
-
expect(page).to have_selector
|
181
|
+
expect(page).to have_selector ".invoice", count: count
|
188
182
|
end
|
189
183
|
|
190
184
|
Then(/^the invoice is displayed correctly$/) do
|
191
|
-
expect(page).to have_selector
|
185
|
+
expect(page).to have_selector ".tracking_id", @invoice.tracking_id
|
192
186
|
end
|
193
187
|
|
194
188
|
Then(/^the total excluding taxes is "(.*?)"$/) do |total|
|
@@ -208,36 +202,36 @@ Then(/^he fill the commercial discount with "(.*?)"$/) do |value|
|
|
208
202
|
end
|
209
203
|
|
210
204
|
Then(/^it's added to the invoice list$/) do
|
211
|
-
step(
|
212
|
-
expect(page).to have_selector
|
205
|
+
step("the user goes to the invoices page")
|
206
|
+
expect(page).to have_selector ".invoice .date", text: @date
|
213
207
|
# There are no other invoices for this test so we should get the right number
|
214
208
|
tracking_id = ::Dorsale::BillingMachine::Invoice.first.tracking_id
|
215
|
-
expect(page).to have_selector
|
216
|
-
expect(page).to have_selector
|
217
|
-
expect(page).to have_selector
|
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 €"
|
218
212
|
end
|
219
213
|
|
220
214
|
Then(/^the commercial discount is "(.*?)"€$/) do |discount|
|
221
|
-
|
215
|
+
expect(find(".commercial_discount input").value).to eq discount
|
222
216
|
end
|
223
217
|
|
224
218
|
Then(/^the invoices's label has changed$/) do
|
225
219
|
visit dorsale.edit_billing_machine_invoice_path(@invoice)
|
226
|
-
expect(page).to have_field(
|
220
|
+
expect(page).to have_field("invoice_label", with: @new_label)
|
227
221
|
end
|
228
222
|
|
229
223
|
Then(/^the VAT rate is "(.*?)"$/) do |rate|
|
230
|
-
expect(
|
224
|
+
expect(find(".vat_rate input").value).to eq rate
|
231
225
|
end
|
232
226
|
|
233
227
|
Then(/^the new line total is "(.*?)"$/) do |value|
|
234
|
-
within all(
|
235
|
-
expect(
|
228
|
+
within all(".line").last do
|
229
|
+
expect(find(".line-total input").value).to eq value
|
236
230
|
end
|
237
231
|
end
|
238
232
|
|
239
233
|
Then(/^the invoice is marked paid$/) do
|
240
|
-
expect(page).to have_selector
|
234
|
+
expect(page).to have_selector ".paid"
|
241
235
|
end
|
242
236
|
|
243
237
|
Then(/^can't set the invoice as paid again$/) do
|
@@ -245,7 +239,7 @@ Then(/^can't set the invoice as paid again$/) do
|
|
245
239
|
end
|
246
240
|
|
247
241
|
Then(/^the invoice is marked unpaid$/) do
|
248
|
-
expect(page).to_not have_selector
|
242
|
+
expect(page).to_not have_selector ".paid"
|
249
243
|
end
|
250
244
|
|
251
245
|
Then(/^the invoice status is set to unpaid$/) do
|
@@ -257,63 +251,63 @@ Then(/^the invoice status is set to paid$/) do
|
|
257
251
|
end
|
258
252
|
|
259
253
|
Then(/^a message signals the success of the update$/) do
|
260
|
-
expect(find(
|
254
|
+
expect(find(".alert-success")).to be_visible
|
261
255
|
end
|
262
256
|
|
263
257
|
Then(/^a message signals the success of the creation$/) do
|
264
|
-
expect(find(
|
258
|
+
expect(find(".alert-success")).to be_visible
|
265
259
|
end
|
266
260
|
|
267
261
|
Then(/^a message signals that the invoice is set to paid$/) do
|
268
|
-
expect(find(
|
262
|
+
expect(find(".alert-success")).to be_visible
|
269
263
|
end
|
270
264
|
|
271
265
|
Then(/^the advance is "(.*?)"€$/) do |advance|
|
272
|
-
expect(
|
266
|
+
expect(find(".advance input").value).to eq advance
|
273
267
|
end
|
274
268
|
|
275
269
|
Then(/^the balance is "(.*?)"$/) do |balance|
|
276
|
-
expect(
|
270
|
+
expect(find(".balance input").value).to eq balance
|
277
271
|
end
|
278
272
|
|
279
273
|
Then(/^the invoice line shows the right date$/) do
|
280
|
-
expect(page).to have_selector
|
274
|
+
expect(page).to have_selector ".date", text: I18n.l(@invoice.date)
|
281
275
|
end
|
282
276
|
|
283
277
|
Then(/^the invoice line shows the right traking-id$/) do
|
284
|
-
expect(page).to have_selector
|
278
|
+
expect(page).to have_selector ".tracking_id", text: @invoice.tracking_id
|
285
279
|
end
|
286
280
|
|
287
281
|
Then(/^the invoice line shows the right total excluding taxes value$/) do
|
288
|
-
expect(page).to have_selector
|
282
|
+
expect(page).to have_selector ".total_excluding_taxes", text: "9,99 €"
|
289
283
|
end
|
290
284
|
|
291
285
|
Then(/^the invoice line shows the right total including taxes value$/) do
|
292
|
-
expect(page).to have_selector
|
286
|
+
expect(page).to have_selector ".total_including_taxes", text: "11,99 €"
|
293
287
|
end
|
294
288
|
|
295
289
|
Then(/^the invoice line shows the right customer's name$/) do
|
296
|
-
expect(page).to have_selector
|
290
|
+
expect(page).to have_selector ".customer_name", text: @customer.name
|
297
291
|
end
|
298
292
|
|
299
293
|
Then(/^the invoice default date is set to today's date\.$/) do
|
300
|
-
expect(page).to have_field(
|
294
|
+
expect(page).to have_field("invoice_date", with: I18n.l(Date.current))
|
301
295
|
end
|
302
296
|
|
303
297
|
Then(/^the invoice default due date is set to today's date\.$/) do
|
304
|
-
expect(page).to have_field(
|
298
|
+
expect(page).to have_field("invoice_due_date", with: I18n.l(Date.current + 30.days))
|
305
299
|
end
|
306
300
|
|
307
301
|
Then(/^a new invoice is displayed with the informations$/) do
|
308
|
-
expect(page).to have_field(
|
302
|
+
expect(page).to have_field("invoice_label", with: @invoice.label)
|
309
303
|
end
|
310
304
|
|
311
305
|
Then(/^he can see all the informations$/) do
|
312
|
-
expect(page).to have_selector
|
306
|
+
expect(page).to have_selector ".invoice-label", @invoice.label
|
313
307
|
end
|
314
308
|
|
315
309
|
Then(/^only the invoices of this customer do appear$/) do
|
316
|
-
expect(page).to have_selector(".customer_name", text:
|
310
|
+
expect(page).to have_selector(".customer_name", text: "Bidule", count: 2)
|
317
311
|
end
|
318
312
|
|
319
313
|
Then(/^only the invoices of today do appear$/) do
|
@@ -360,7 +354,7 @@ Then(/^an invoice is sent to customer$/) do
|
|
360
354
|
end
|
361
355
|
|
362
356
|
When(/^he filters invoices between two date$/) do
|
363
|
-
fill_in :filters_bm_date_begin, with: I18n.l(
|
364
|
-
fill_in :filters_bm_date_end, with: I18n.l(
|
357
|
+
fill_in :filters_bm_date_begin, with: I18n.l(Date.current)
|
358
|
+
fill_in :filters_bm_date_end, with: I18n.l(Date.current)
|
365
359
|
find(".filter-submit").click
|
366
360
|
end
|
@@ -3,18 +3,17 @@ Given(/^billing machine in multiple vat mode$/) do
|
|
3
3
|
end
|
4
4
|
|
5
5
|
When(/^he fills the reference, the date and the payment terms$/) do
|
6
|
-
fill_in
|
7
|
-
fill_in
|
6
|
+
fill_in "invoice_label", with: @label = "My reference"
|
7
|
+
fill_in "invoice_date", with: @date = "01/01/2014"
|
8
8
|
select @payment_term.label
|
9
9
|
end
|
10
10
|
|
11
11
|
When(/^he fills a multiple vat line with "(.*?)", "(.*?)", "(.*?)", "(.*?)", "(.*?)"$/) do |label, quantity, unit, vat_rate, unit_price|
|
12
|
-
within all(
|
12
|
+
within all(".line").last do
|
13
13
|
find(".line-label textarea").set label
|
14
|
-
find(".line-quantity input").set
|
15
|
-
find(".line-unit input").set
|
14
|
+
find(".line-quantity input").set quantity
|
15
|
+
find(".line-unit input").set unit
|
16
16
|
find(".line-vat_rate input").set vat_rate
|
17
17
|
find(".line-unit_price input").set unit_price
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
@@ -4,7 +4,7 @@ Given(/^the user goes on the new payment_term page$/) do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
When(/^he fills the payment_term's information$/) do
|
7
|
-
fill_in
|
7
|
+
fill_in "billing_machine_payment_term_label", with: "Payment Term Label"
|
8
8
|
end
|
9
9
|
|
10
10
|
When(/^creates a new payment_term$/) do
|
@@ -39,4 +39,4 @@ end
|
|
39
39
|
|
40
40
|
Then(/^the payment_term's label is updated$/) do
|
41
41
|
expect(page).to have_content "New Payment Term Label"
|
42
|
-
end
|
42
|
+
end
|
@@ -1,87 +1,53 @@
|
|
1
1
|
Given(/^an existing quotation$/) do
|
2
|
-
@quotation = create(:billing_machine_quotation,
|
2
|
+
@quotation = create(:billing_machine_quotation, customer: @customer)
|
3
3
|
@quotation.lines.create(quantity: 1, unit_price: 9.99)
|
4
4
|
end
|
5
5
|
|
6
6
|
Given(/^(\d+) existing quotations$/) do |nb|
|
7
|
-
create_list(:billing_machine_quotation, nb.to_i
|
7
|
+
create_list(:billing_machine_quotation, nb.to_i)
|
8
8
|
end
|
9
9
|
|
10
10
|
Given(/^an existing emtpy quotation$/) do
|
11
|
-
@quotation = create(:billing_machine_quotation, label: nil, customer: nil
|
11
|
+
@quotation = create(:billing_machine_quotation, label: nil, customer: nil)
|
12
12
|
end
|
13
13
|
|
14
14
|
Given(/^an existing quotation with a "(.*?)"% VAT rate$/) do |rate|
|
15
|
-
@quotation = create(:billing_machine_quotation
|
15
|
+
@quotation = create(:billing_machine_quotation)
|
16
16
|
create(:billing_machine_quotation_line, vat_rate: rate, quotation: @quotation)
|
17
17
|
end
|
18
18
|
|
19
|
-
Given(/^(\d+) associated documents to this quotation$/) do |
|
20
|
-
|
21
|
-
|
19
|
+
Given(/^(\d+) associated documents to this quotation$/) do |n|
|
20
|
+
n.to_i.times do |i|
|
21
|
+
instance_variable_set "@document#{i}", create(:alexandrie_attachment, attachable: @quotation)
|
22
|
+
end
|
22
23
|
end
|
23
24
|
|
24
25
|
Given(/^a bunch of existing quotations$/) do
|
25
|
-
c1 = create(:customer_vault_corporation, name:
|
26
|
-
c2 = create(:customer_vault_corporation, name:
|
27
|
-
c3 = create(:customer_vault_corporation, name:
|
28
|
-
|
29
|
-
i1 = create(:customer_vault_individual, first_name:
|
30
|
-
i2 = create(:customer_vault_individual, first_name:
|
31
|
-
i3 = create(:customer_vault_individual, first_name:
|
32
|
-
|
33
|
-
create(:billing_machine_quotation,
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
)
|
38
|
-
create(:billing_machine_quotation,
|
39
|
-
|
40
|
-
:customer => c2,
|
41
|
-
:date => Time.zone.now.to_date,
|
42
|
-
)
|
43
|
-
create(:billing_machine_quotation,
|
44
|
-
:id_card => @id_card,
|
45
|
-
:customer => c3,
|
46
|
-
:date => Time.zone.now.to_date,
|
47
|
-
)
|
48
|
-
create(:billing_machine_quotation,
|
49
|
-
:id_card => @id_card,
|
50
|
-
:customer => c1,
|
51
|
-
:date => Time.zone.now.to_date - 2.days,
|
52
|
-
)
|
53
|
-
|
54
|
-
create(:billing_machine_quotation,
|
55
|
-
:id_card => @id_card,
|
56
|
-
:customer => i1,
|
57
|
-
:date => Time.zone.now.to_date - 3.days,
|
58
|
-
)
|
59
|
-
create(:billing_machine_quotation,
|
60
|
-
:id_card => @id_card,
|
61
|
-
:customer => i2,
|
62
|
-
:date => Time.zone.now.to_date - 3.days,
|
63
|
-
)
|
64
|
-
create(:billing_machine_quotation,
|
65
|
-
:id_card => @id_card,
|
66
|
-
:customer => i3,
|
67
|
-
:date => Time.zone.now.to_date - 3.days,
|
68
|
-
)
|
26
|
+
c1 = create(:customer_vault_corporation, name: "Bidule")
|
27
|
+
c2 = create(:customer_vault_corporation, name: "Machin")
|
28
|
+
c3 = create(:customer_vault_corporation, name: "Chose")
|
29
|
+
|
30
|
+
i1 = create(:customer_vault_individual, first_name: "Oh")
|
31
|
+
i2 = create(:customer_vault_individual, first_name: "Ah")
|
32
|
+
i3 = create(:customer_vault_individual, first_name: "Eh")
|
33
|
+
|
34
|
+
create(:billing_machine_quotation, customer: c1, date: Date.current)
|
35
|
+
create(:billing_machine_quotation, customer: c2, date: Date.current)
|
36
|
+
create(:billing_machine_quotation, customer: c3, date: Date.current)
|
37
|
+
create(:billing_machine_quotation, customer: c1, date: Date.current - 2.days)
|
38
|
+
create(:billing_machine_quotation, customer: i1, date: Date.current - 3.days)
|
39
|
+
create(:billing_machine_quotation, customer: i2, date: Date.current - 3.days)
|
40
|
+
create(:billing_machine_quotation, customer: i3, date: Date.current - 3.days)
|
69
41
|
end
|
70
42
|
|
71
43
|
Given(/^existing "(.*?)" quotations with "(.*?)" amount$/) do |n, amount|
|
72
44
|
n.to_i.times do
|
73
|
-
|
74
|
-
quotation_line = create(:billing_machine_quotation_line,
|
75
|
-
quotation: quotation,
|
76
|
-
quantity: 1,
|
77
|
-
unit_price: amount,
|
78
|
-
total: nil
|
79
|
-
)
|
45
|
+
create(:billing_machine_quotation_line, quantity: 1, unit_price: amount)
|
80
46
|
end
|
81
47
|
end
|
82
48
|
|
83
49
|
When(/^he changes the quotation VAT rate to "(.*?)"$/) do |arg1|
|
84
|
-
fill_in
|
50
|
+
fill_in "quotation_vat_rate", with: arg1
|
85
51
|
end
|
86
52
|
|
87
53
|
When(/^the user goes to the quotations page$/) do
|
@@ -89,23 +55,23 @@ When(/^the user goes to the quotations page$/) do
|
|
89
55
|
end
|
90
56
|
|
91
57
|
When(/^the quotation line shows the right date$/) do
|
92
|
-
page.should have_selector
|
58
|
+
page.should have_selector ".date", text: I18n.l(@quotation.date)
|
93
59
|
end
|
94
60
|
|
95
61
|
When(/^the quotation line shows the right traking\-id$/) do
|
96
|
-
page.should have_selector
|
62
|
+
page.should have_selector ".tracking_id", text: @quotation.tracking_id
|
97
63
|
end
|
98
64
|
|
99
65
|
When(/^the quotation line shows the right customer's name$/) do
|
100
|
-
page.should have_selector
|
66
|
+
page.should have_selector ".customer_name", text: @customer.name
|
101
67
|
end
|
102
68
|
|
103
69
|
When(/^the quotation line shows the right total excluding taxes value$/) do
|
104
|
-
page.should have_selector
|
70
|
+
page.should have_selector ".total_excluding_taxes", text: "9,99 €"
|
105
71
|
end
|
106
72
|
|
107
73
|
When(/^the quotation line shows the right total including taxes value$/) do
|
108
|
-
page.should have_selector
|
74
|
+
page.should have_selector ".total_including_taxes", text: "11,99 €"
|
109
75
|
end
|
110
76
|
|
111
77
|
When(/^the user goes to the quotation details$/) do
|
@@ -117,10 +83,10 @@ When(/^he creates a new quotation$/) do
|
|
117
83
|
end
|
118
84
|
|
119
85
|
When(/^he fills the reference and the date$/) do
|
120
|
-
fill_in
|
121
|
-
fill_in
|
86
|
+
fill_in "quotation_label", with: @label = "My reference"
|
87
|
+
fill_in "quotation_date", with: @date = "01/01/2014"
|
122
88
|
select @payment_term.label
|
123
|
-
fill_in
|
89
|
+
fill_in "quotation_comments", with: "I-am-a-comment"
|
124
90
|
end
|
125
91
|
|
126
92
|
When(/^he saves the quotation$/) do
|
@@ -133,7 +99,7 @@ end
|
|
133
99
|
|
134
100
|
When(/^changes the quotation label$/) do
|
135
101
|
@new_label= @quotation.label + " Edited"
|
136
|
-
fill_in
|
102
|
+
fill_in "quotation_label", with: @new_label
|
137
103
|
end
|
138
104
|
|
139
105
|
When(/^he copy the quotation$/) do
|
@@ -153,20 +119,20 @@ end
|
|
153
119
|
|
154
120
|
Then(/^the document is not in the quotation details$/) do
|
155
121
|
visit dorsale.billing_machine_quotation_path(@quotation)
|
156
|
-
page.should have_link
|
122
|
+
page.should have_link "pdf.pdf", count: 1
|
157
123
|
end
|
158
124
|
|
159
125
|
Then(/^a message signals the success of the quotation update$/) do
|
160
|
-
page.should have_selector
|
126
|
+
page.should have_selector ".alert-success"
|
161
127
|
end
|
162
128
|
|
163
129
|
Then(/^he fill the quotation commercial discount with "(.*?)"$/) do |arg1|
|
164
|
-
fill_in
|
130
|
+
fill_in "quotation_commercial_discount", with: arg1
|
165
131
|
end
|
166
132
|
|
167
133
|
Then(/^the quotation's label has changed$/) do
|
168
134
|
visit dorsale.edit_billing_machine_quotation_path(@quotation)
|
169
|
-
page.should have_field(
|
135
|
+
page.should have_field("quotation_label", with: @new_label)
|
170
136
|
end
|
171
137
|
|
172
138
|
Then(/^I am on the created quotation$/) do
|
@@ -175,29 +141,29 @@ Then(/^I am on the created quotation$/) do
|
|
175
141
|
end
|
176
142
|
|
177
143
|
Then(/^he can see all the quotation informations$/) do
|
178
|
-
expect(page).to have_selector
|
144
|
+
expect(page).to have_selector ".quotation-label", @quotation.label
|
179
145
|
|
180
146
|
expect(page).to have_selector ".quotation-expires_at", "21/12/2012"
|
181
147
|
end
|
182
148
|
|
183
149
|
Then(/^the quotation default date is set to today's date\.$/) do
|
184
|
-
page.should have_field(
|
150
|
+
page.should have_field("quotation_date", with: I18n.l(Date.current))
|
185
151
|
end
|
186
152
|
|
187
153
|
Then(/^he should see (\d+) quotations?$/) do |arg1|
|
188
|
-
page.should have_selector
|
154
|
+
page.should have_selector ".quotation", count: arg1
|
189
155
|
end
|
190
156
|
|
191
157
|
Then(/^the quotation is displayed correctly$/) do
|
192
|
-
expect(page).to have_selector
|
158
|
+
expect(page).to have_selector ".tracking_id", @quotation.tracking_id
|
193
159
|
end
|
194
160
|
|
195
161
|
Then(/^a message signals the success of the quotation creation$/) do
|
196
|
-
page.should have_selector
|
162
|
+
page.should have_selector ".alert-success"
|
197
163
|
end
|
198
164
|
|
199
165
|
Then(/^he will see links to the documents$/) do
|
200
|
-
page.should have_link
|
166
|
+
page.should have_link "pdf.pdf", count: 2
|
201
167
|
end
|
202
168
|
|
203
169
|
Then(/^the quotation informations are visible on the quotation details$/) do
|
@@ -208,7 +174,7 @@ Then(/^the quotation informations are visible on the quotation details$/) do
|
|
208
174
|
end
|
209
175
|
|
210
176
|
Then(/^only the quotations of this customer do appear$/) do
|
211
|
-
expect(page).to have_selector(".customer_name", text:
|
177
|
+
expect(page).to have_selector(".customer_name", text: "Bidule", count: 2)
|
212
178
|
end
|
213
179
|
|
214
180
|
Then(/^only the quotations of today do appear$/) do
|
@@ -242,4 +208,3 @@ Then(/^only the "(.*?)" quotations appear$/) do |state|
|
|
242
208
|
expect(page).to have_selector("tr.quotation", count: 1)
|
243
209
|
expect(find("tr.quotation")).to have_content(state_i18n)
|
244
210
|
end
|
245
|
-
|