dorsale 3.14.4 → 3.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/features/access.feature +17 -0
- data/features/billing_machine_invoices.feature +261 -0
- data/features/billing_machine_multiple_vat.feature +53 -0
- data/features/billing_machine_payment_terms.feature +19 -0
- data/features/billing_machine_quotations.feature +193 -0
- data/features/customer_vault_activity_types.feature +19 -0
- data/features/customer_vault_corporations.feature +95 -0
- data/features/customer_vault_filters.feature +14 -0
- data/features/customer_vault_individuals.feature +35 -0
- data/features/customer_vault_invoices.feature +10 -0
- data/features/customer_vault_links.feature +54 -0
- data/features/customer_vault_origins.feature +19 -0
- data/features/customer_vault_people.feature +25 -0
- data/features/customer_vault_search.feature +22 -0
- data/features/customer_vault_tasks.feature +35 -0
- data/features/expense_gun_categories.feature +19 -0
- data/features/expense_gun_expenses.feature +60 -0
- data/features/flyboy_task_comments.feature +21 -0
- data/features/flyboy_tasks.feature +122 -0
- data/features/flyboy_tasks_summary.feature +22 -0
- data/features/step_definitions/access_steps.rb +15 -0
- data/features/step_definitions/alexandrie_steps.rb +25 -0
- data/features/step_definitions/billing_machine_invoices_steps.rb +377 -0
- data/features/step_definitions/billing_machine_multiple_vat.rb +19 -0
- data/features/step_definitions/billing_machine_payment_terms_steps.rb +42 -0
- data/features/step_definitions/billing_machine_quotations_steps.rb +248 -0
- data/features/step_definitions/common_steps.rb +91 -0
- data/features/step_definitions/customer_vault_activity_types_steps.rb +42 -0
- data/features/step_definitions/customer_vault_corporations_steps.rb +218 -0
- data/features/step_definitions/customer_vault_filters_steps.rb +37 -0
- data/features/step_definitions/customer_vault_individuals_steps.rb +67 -0
- data/features/step_definitions/customer_vault_invoices_steps.rb +7 -0
- data/features/step_definitions/customer_vault_links_steps.rb +73 -0
- data/features/step_definitions/customer_vault_origins_steps.rb +42 -0
- data/features/step_definitions/customer_vault_people_steps.rb +26 -0
- data/features/step_definitions/customer_vault_search_steps.rb +48 -0
- data/features/step_definitions/customer_vault_tasks_steps.rb +34 -0
- data/features/step_definitions/expense_gun_categories_steps.rb +50 -0
- data/features/step_definitions/expense_gun_expenses_steps.rb +135 -0
- data/features/step_definitions/flyboy_task_comments_steps.rb +10 -0
- data/features/step_definitions/flyboy_tasks_steps.rb +196 -0
- data/features/step_definitions/tasks_summary_steps.rb +30 -0
- data/features/step_definitions/users_management_step.rb +29 -0
- data/features/support/env.rb +8 -0
- data/features/users_management.feature +18 -0
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +145 -0
- data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +153 -0
- data/spec/controllers/dorsale/billing_machine/quotations_controller_spec.rb +24 -0
- data/spec/controllers/dorsale/comments_controller_spec.rb +50 -0
- data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +42 -0
- data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +129 -0
- data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +55 -0
- data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +40 -0
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +349 -0
- data/spec/factories/alexandrie_attachment_types.rb +5 -0
- data/spec/factories/alexandrie_attachments.rb +16 -0
- data/spec/factories/billing_machine_invoice_lines.rb +9 -0
- data/spec/factories/billing_machine_invoices.rb +9 -0
- data/spec/factories/billing_machine_payment_terms.rb +5 -0
- data/spec/factories/billing_machine_quotation_lines.rb +9 -0
- data/spec/factories/billing_machine_quotations.rb +9 -0
- data/spec/factories/customer_vault_activity_types.rb +5 -0
- data/spec/factories/customer_vault_corporations.rb +13 -0
- data/spec/factories/customer_vault_event.rb +13 -0
- data/spec/factories/customer_vault_individuals.rb +17 -0
- data/spec/factories/customer_vault_links.rb +7 -0
- data/spec/factories/customer_vault_origins.rb +5 -0
- data/spec/factories/dorsale_addresses.rb +9 -0
- data/spec/factories/dorsale_comments.rb +7 -0
- data/spec/factories/expense_gun_categories.rb +7 -0
- data/spec/factories/expense_gun_expense_lines.rb +11 -0
- data/spec/factories/expense_gun_expenses.rb +13 -0
- data/spec/factories/flyboy_task_comments.rb +9 -0
- data/spec/factories/flyboy_tasks.rb +8 -0
- data/spec/files/avatar.png +0 -0
- data/spec/files/pdf.pdf +0 -0
- data/spec/mailers/user_mailer_spec.rb +21 -0
- data/spec/models/dorsale/address_spec.rb +46 -0
- data/spec/models/dorsale/alexandrie/attachment_spec.rb +36 -0
- data/spec/models/dorsale/alexandrie/attachment_type_spec.rb +11 -0
- data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +52 -0
- data/spec/models/dorsale/billing_machine/invoice_spec.rb +258 -0
- data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +51 -0
- data/spec/models/dorsale/billing_machine/quotation_spec.rb +213 -0
- data/spec/models/dorsale/billing_machine_spec.rb +57 -0
- data/spec/models/dorsale/comment_spec.rb +24 -0
- data/spec/models/dorsale/customer_vault/activity_type_spec.rb +10 -0
- data/spec/models/dorsale/customer_vault/corporation_spec.rb +33 -0
- data/spec/models/dorsale/customer_vault/event_spec.rb +22 -0
- data/spec/models/dorsale/customer_vault/individual_spec.rb +44 -0
- data/spec/models/dorsale/customer_vault/link_spec.rb +14 -0
- data/spec/models/dorsale/customer_vault/origin_spec.rb +8 -0
- data/spec/models/dorsale/customer_vault/person_spec.rb +112 -0
- data/spec/models/dorsale/email_spec.rb +39 -0
- data/spec/models/dorsale/expense_gun/category_spec.rb +9 -0
- data/spec/models/dorsale/expense_gun/expense_line_spec.rb +53 -0
- data/spec/models/dorsale/expense_gun/expense_spec.rb +176 -0
- data/spec/models/dorsale/flyboy/task_comment_spec.rb +54 -0
- data/spec/models/dorsale/flyboy/task_spec.rb +254 -0
- data/spec/models/dorsale/i18n_spec.rb +30 -0
- data/spec/models/dorsale/users_spec.rb +65 -0
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +42 -0
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +42 -0
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +42 -0
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +55 -0
- data/spec/pdfs/dorsale/expense_gun/expense_pdf_spec.rb +11 -0
- data/spec/rails_helper.rb +57 -0
- data/spec/routing/dorsale/alexandrie/attachments_routing_spec.rb +32 -0
- data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +67 -0
- data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +67 -0
- data/spec/routing/dorsale/comments_routing_spec.rb +23 -0
- data/spec/routing/dorsale/customer_vault/activity_types_routing_spec.rb +40 -0
- data/spec/routing/dorsale/customer_vault/events_routing_spec.rb +12 -0
- data/spec/routing/dorsale/customer_vault/origins_routing_spec.rb +40 -0
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +109 -0
- data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +62 -0
- data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +11 -0
- data/spec/routing/dorsale/flyboy/tasks_routing_spec.rb +51 -0
- data/spec/routing/dorsale/users_routing_spec.rb +38 -0
- data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +55 -0
- data/spec/services/dorsale/billing_machine/quotation/statistics.rb +23 -0
- data/spec/services/dorsale/billing_machine/quotation/to_invoice_spec.rb +46 -0
- data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +83 -0
- data/spec/services/dorsale/flyboy/task/copy_spec.rb +24 -0
- data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +117 -0
- data/spec/spec_helper.rb +86 -0
- data/spec/support/devise.rb +3 -0
- data/spec/support/message_delivery.rb +5 -0
- metadata +258 -2
@@ -0,0 +1,37 @@
|
|
1
|
+
Given(/^an existing corporation with tags hello and world$/) do
|
2
|
+
@corporation1 = create(:customer_vault_corporation, tag_list: "hello, world")
|
3
|
+
end
|
4
|
+
|
5
|
+
Given(/^an other existing corporation with tags hello and goodbye$/) do
|
6
|
+
@corporation2 = create(:customer_vault_corporation, tag_list: "hello, goodbye")
|
7
|
+
end
|
8
|
+
|
9
|
+
Given(/^an other existing corporation with tag yeah$/) do
|
10
|
+
@corporation3 = create(:customer_vault_corporation, tag_list: "yeah")
|
11
|
+
end
|
12
|
+
|
13
|
+
When(/^I go the to people list$/) do
|
14
|
+
visit dorsale.customer_vault_people_path
|
15
|
+
end
|
16
|
+
|
17
|
+
When(/^I filter with tag hello$/) do
|
18
|
+
select("hello")
|
19
|
+
find(".filter-submit").click
|
20
|
+
end
|
21
|
+
|
22
|
+
Then(/^only first and second corporation appear$/) do
|
23
|
+
expect(page).to have_content @corporation1.name
|
24
|
+
expect(page).to have_content @corporation2.name
|
25
|
+
expect(page).to have_no_content @corporation3.name
|
26
|
+
end
|
27
|
+
|
28
|
+
When(/^I add the second tag world$/) do
|
29
|
+
select "world"
|
30
|
+
find(".filter-submit").click
|
31
|
+
end
|
32
|
+
|
33
|
+
Then(/^only the first corporation appear$/) do
|
34
|
+
expect(page).to have_content @corporation1.name
|
35
|
+
expect(page).to have_no_content @corporation2.name
|
36
|
+
expect(page).to have_no_content @corporation3.name
|
37
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
When(/^I create an new individual$/) do
|
2
|
+
@individuals_count = Dorsale::CustomerVault::Individual.count
|
3
|
+
|
4
|
+
visit dorsale.new_customer_vault_individual_path
|
5
|
+
end
|
6
|
+
|
7
|
+
When(/^I add his first_name, last_name and email$/) do
|
8
|
+
fill_in "person_first_name", with: "Benoit"
|
9
|
+
fill_in "person_last_name", with: "Gantaume"
|
10
|
+
fill_in "person_email", with: "benoit@agilidee.com"
|
11
|
+
end
|
12
|
+
|
13
|
+
When(/^I fill the address$/) do
|
14
|
+
fill_in "person_address_attributes_street", with: "3 Rue Marx Dormoy"
|
15
|
+
fill_in "person_address_attributes_street_bis", with: ""
|
16
|
+
fill_in "person_address_attributes_city", with: "Marseille"
|
17
|
+
fill_in "person_address_attributes_zip", with: "13004"
|
18
|
+
fill_in "person_address_attributes_country", with: "France"
|
19
|
+
end
|
20
|
+
|
21
|
+
When(/^I validate the new individual$/) do
|
22
|
+
find("[type=submit]").click
|
23
|
+
end
|
24
|
+
|
25
|
+
Then(/^i see an error message for the missing names$/) do
|
26
|
+
expect(page).to have_selector ".person_first_name.has-error"
|
27
|
+
expect(page).to have_selector ".person_last_name.has-error"
|
28
|
+
end
|
29
|
+
|
30
|
+
Then(/^the individual is created$/) do
|
31
|
+
expect(Dorsale::CustomerVault::Individual.count).to eq(@individuals_count + 1)
|
32
|
+
|
33
|
+
@individual = Dorsale::CustomerVault::Individual.last_created
|
34
|
+
|
35
|
+
expect(@individual.first_name).to eq "Benoit"
|
36
|
+
expect(@individual.last_name).to eq "Gantaume"
|
37
|
+
end
|
38
|
+
|
39
|
+
When(/^I edit this individual$/) do
|
40
|
+
visit dorsale.edit_customer_vault_individual_path(@individual)
|
41
|
+
end
|
42
|
+
|
43
|
+
When(/^I add tags to this individual$/) do
|
44
|
+
page.execute_script %(
|
45
|
+
$("#person_tag_list").append("<option value='mytag1'>mytag1</option>")
|
46
|
+
$("#person_tag_list").append("<option value='mytag2'>mytag2</option>")
|
47
|
+
)
|
48
|
+
|
49
|
+
select "mytag1"
|
50
|
+
select "mytag2"
|
51
|
+
end
|
52
|
+
|
53
|
+
When(/^I submit this individual$/) do
|
54
|
+
find("[type=submit]").click
|
55
|
+
end
|
56
|
+
|
57
|
+
Given(/^an existing individual with tags$/) do
|
58
|
+
@individual = create(:customer_vault_individual, tag_list: "mytag1, mytag2")
|
59
|
+
end
|
60
|
+
|
61
|
+
When(/^I remove tags to this individual$/) do
|
62
|
+
unselect "mytag1"
|
63
|
+
end
|
64
|
+
|
65
|
+
When(/^I go on this individual$/) do
|
66
|
+
visit dorsale.customer_vault_individual_path(@individual)
|
67
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Given(/^this (?:corporation|individual|person) has an invoice$/) do
|
2
|
+
@invoice = create(:billing_machine_invoice, customer: @person)
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^he go on he (?:corporation|individual|person) invoices page$/) do
|
6
|
+
visit dorsale.invoices_customer_vault_person_path(@person)
|
7
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
Given(/^an existing corporation$/) do
|
2
|
+
@corporation = create(:customer_vault_corporation)
|
3
|
+
@person = @corporation
|
4
|
+
end
|
5
|
+
|
6
|
+
Given(/^an existing individual$/) do
|
7
|
+
@individual = create(:customer_vault_individual)
|
8
|
+
@person = @individual
|
9
|
+
end
|
10
|
+
|
11
|
+
Given(/^an existing link$/) do
|
12
|
+
@link = create(:customer_vault_link)
|
13
|
+
@individual = @link.alice
|
14
|
+
@corporation = @link.bob
|
15
|
+
end
|
16
|
+
|
17
|
+
When(/^I navigate to the link section of the indidual details$/) do
|
18
|
+
visit dorsale.customer_vault_individual_path(@individual)
|
19
|
+
find("a[href$=links]").click
|
20
|
+
end
|
21
|
+
|
22
|
+
When(/^I add a new link to the corporation$/) do
|
23
|
+
find("#context-main [href$='links/new']").click
|
24
|
+
expect(current_path).to eq dorsale.new_customer_vault_corporation_link_path(@corporation)
|
25
|
+
end
|
26
|
+
|
27
|
+
When(/^I add a new link to the individual$/) do
|
28
|
+
find("#context-main [href$='links/new']").click
|
29
|
+
expect(current_path).to eq dorsale.new_customer_vault_individual_link_path(@individual)
|
30
|
+
end
|
31
|
+
|
32
|
+
When(/^I provide the link and the target corporation$/) do
|
33
|
+
select @corporation.name
|
34
|
+
fill_in "link_title", with: "Manager"
|
35
|
+
end
|
36
|
+
|
37
|
+
When(/^I validate the link$/) do
|
38
|
+
find("[type=submit]").click
|
39
|
+
end
|
40
|
+
|
41
|
+
When(/^I edit the link$/) do
|
42
|
+
find(".person .pull-right .link_update").click
|
43
|
+
end
|
44
|
+
|
45
|
+
When(/^I change the title$/) do
|
46
|
+
fill_in "link_title", with: "Manager 2"
|
47
|
+
end
|
48
|
+
|
49
|
+
When(/^I navigate to the link section of the corporation details$/) do
|
50
|
+
visit dorsale.customer_vault_corporation_path(@corporation)
|
51
|
+
find("a[href$=links]").click
|
52
|
+
end
|
53
|
+
|
54
|
+
When(/^I provide the link and the target individual$/) do
|
55
|
+
select @individual.name
|
56
|
+
fill_in "link_title", with: "Manager"
|
57
|
+
end
|
58
|
+
|
59
|
+
When(/^I delete the link$/) do
|
60
|
+
find(".person .pull-right .link_delete").click
|
61
|
+
end
|
62
|
+
|
63
|
+
Then(/^the new link is displayed$/) do
|
64
|
+
expect(page).to have_selector ".title", text: "Manager"
|
65
|
+
end
|
66
|
+
|
67
|
+
Then(/^the edited link is displayed$/) do
|
68
|
+
expect(page).to have_selector ".title", text: "Manager 2"
|
69
|
+
end
|
70
|
+
|
71
|
+
Then(/^the targeted link is removed$/) do
|
72
|
+
expect(page).to_not have_selector ".title", text: "Manager"
|
73
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Given(/^the user goes on the new origin page$/) do
|
2
|
+
visit dorsale.customer_vault_origins_path
|
3
|
+
find(".link_create").click
|
4
|
+
end
|
5
|
+
|
6
|
+
When(/^he fills the origin's information$/) do
|
7
|
+
fill_in "origin_name", with: "Origin Name"
|
8
|
+
end
|
9
|
+
|
10
|
+
When(/^creates a new origin$/) do
|
11
|
+
find("[type=submit]").click
|
12
|
+
end
|
13
|
+
|
14
|
+
Then(/^he is redirected on the origins page$/) do
|
15
|
+
expect(current_path).to eq dorsale.customer_vault_origins_path
|
16
|
+
end
|
17
|
+
|
18
|
+
Then(/^the origin is added to the origin list$/) do
|
19
|
+
expect(page).to have_content "Origin Name"
|
20
|
+
end
|
21
|
+
|
22
|
+
Given(/^an existing origin$/) do
|
23
|
+
@origin = create(:customer_vault_origin)
|
24
|
+
end
|
25
|
+
|
26
|
+
When(/^I edit the origin$/) do
|
27
|
+
visit dorsale.customer_vault_origins_path
|
28
|
+
find(".link_update").click
|
29
|
+
end
|
30
|
+
|
31
|
+
Then(/^the current origin's name should be pre\-filled$/) do
|
32
|
+
expect(page).to have_field("origin_name", with: @origin.name)
|
33
|
+
end
|
34
|
+
|
35
|
+
When(/^he validates the new origin$/) do
|
36
|
+
fill_in "origin_name", with: "New Origin Name"
|
37
|
+
find("[type=submit]").click
|
38
|
+
end
|
39
|
+
|
40
|
+
Then(/^the origin's label is updated$/) do
|
41
|
+
expect(page).to have_content "New Origin Name"
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
When(/^I export people list$/) do
|
2
|
+
find("[href$=xlsx]").click
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^the file is downloaded$/) do
|
6
|
+
# Nothing to do, error appears in previous step if any problem
|
7
|
+
end
|
8
|
+
|
9
|
+
Given(/^a very long comment on this person$/) do
|
10
|
+
text = Faker::Lorem.paragraph(30)
|
11
|
+
@comment = create(:customer_vault_event_comment, person: @person, text: text)
|
12
|
+
end
|
13
|
+
|
14
|
+
Then(/^I see the truncated comment$/) do
|
15
|
+
expect(page).to have_selector(".comment-text-truncated")
|
16
|
+
expect(page).to have_no_selector(".comment-text")
|
17
|
+
end
|
18
|
+
|
19
|
+
Then(/^I see the full comment$/) do
|
20
|
+
expect(page).to have_selector(".comment-text")
|
21
|
+
expect(page).to have_no_selector(".comment-text-truncated")
|
22
|
+
end
|
23
|
+
|
24
|
+
Given(/^a short comment on this person$/) do
|
25
|
+
@comment = create(:customer_vault_event_comment, person: @person, text: "i am short")
|
26
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Lorsqu(/^he go to the people list$/) do
|
2
|
+
visit dorsale.customer_vault_people_path
|
3
|
+
end
|
4
|
+
|
5
|
+
Etantdonné(/^existing individuals$/) do
|
6
|
+
@individual1 = create(:customer_vault_individual, first_name: "Jean", last_name: "DUPONT")
|
7
|
+
@individual2 = create(:customer_vault_individual, first_name: "Laurent", last_name: "DURAND")
|
8
|
+
end
|
9
|
+
|
10
|
+
Etantdonné(/^existing corporations$/) do
|
11
|
+
@corporation1 = create(:customer_vault_corporation, name: "aaa", email: "contact@aaa.com")
|
12
|
+
@corporation2 = create(:customer_vault_corporation, name: "zzz", email: "contact@zzz.com")
|
13
|
+
end
|
14
|
+
|
15
|
+
Lorsqu(/^he search an individual by first name$/) do
|
16
|
+
fill_in "q", with: "Jean"
|
17
|
+
find(".search-submit").click
|
18
|
+
end
|
19
|
+
|
20
|
+
Alors(/^this individual appear in search results$/) do
|
21
|
+
expect(page).to have_content "Jean"
|
22
|
+
expect(page).to have_content "DUPONT"
|
23
|
+
end
|
24
|
+
|
25
|
+
Alors(/^other individuals do not appear in search results$/) do
|
26
|
+
expect(page).to have_no_content "Laurent"
|
27
|
+
expect(page).to have_no_content "DURAND"
|
28
|
+
end
|
29
|
+
|
30
|
+
Lorsqu(/^he search an individual by last name$/) do
|
31
|
+
fill_in "q", with: "DUPONT"
|
32
|
+
find(".search-submit").click
|
33
|
+
end
|
34
|
+
|
35
|
+
Lorsqu(/^he search a corporation by name$/) do
|
36
|
+
fill_in "q", with: "aaa"
|
37
|
+
find(".search-submit").click
|
38
|
+
end
|
39
|
+
|
40
|
+
Alors(/^this corporation appear in search results$/) do
|
41
|
+
expect(page).to have_content "aaa"
|
42
|
+
expect(page).to have_content "contact@aaa.com"
|
43
|
+
end
|
44
|
+
|
45
|
+
Alors(/^other corporations do not appear in search results$/) do
|
46
|
+
expect(page).to have_no_content "zzz"
|
47
|
+
expect(page).to have_no_content "contact@zzz.com"
|
48
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
When(/^I go on the tasks section$/) do
|
2
|
+
find("#person-tabs a[href$='tasks']").click
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I create a task on this person$/) do
|
6
|
+
@tasks_count = ::Dorsale::Flyboy::Task.count
|
7
|
+
find("#context-main a[href*='tasks/new']").click
|
8
|
+
fill_in :task_name, with: "YepYep"
|
9
|
+
fill_in :task_description, with: "Trololo"
|
10
|
+
find("[type=submit]").click
|
11
|
+
end
|
12
|
+
|
13
|
+
Then(/^the person task is created$/) do
|
14
|
+
expect(::Dorsale::Flyboy::Task.count).to eq(@tasks_count + 1)
|
15
|
+
@task = ::Dorsale::Flyboy::Task.last_created
|
16
|
+
person = @corporation || @individual || @person
|
17
|
+
expect(current_path).to eq dorsale.tasks_customer_vault_person_path(person)
|
18
|
+
end
|
19
|
+
|
20
|
+
Then(/^the task appear$/) do
|
21
|
+
expect(page).to have_content "YepYep"
|
22
|
+
end
|
23
|
+
|
24
|
+
When(/^I go on the general tasks page$/) do
|
25
|
+
visit dorsale.flyboy_tasks_path
|
26
|
+
end
|
27
|
+
|
28
|
+
When(/^I filter tasks$/) do
|
29
|
+
find(".filter-submit").click
|
30
|
+
end
|
31
|
+
|
32
|
+
Then(/^I an redirected on the tasks tab$/) do
|
33
|
+
expect(current_path).to eq dorsale.tasks_customer_vault_person_path(@individual)
|
34
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Given(/^the user goes on the new expense category page$/) do
|
2
|
+
visit dorsale.expense_gun_categories_path
|
3
|
+
find(".link_create").click
|
4
|
+
end
|
5
|
+
|
6
|
+
When(/^he fills the category's information$/) do
|
7
|
+
fill_in "category_name", with: "Category Name"
|
8
|
+
fill_in "category_code", with: "Category Code"
|
9
|
+
select "Oui"
|
10
|
+
end
|
11
|
+
|
12
|
+
When(/^creates a new expense category$/) do
|
13
|
+
find("[type=submit]").click
|
14
|
+
end
|
15
|
+
|
16
|
+
Then(/^the category is added to the category list$/) do
|
17
|
+
expect(page).to have_content "Category Name"
|
18
|
+
expect(page).to have_content "Category Code"
|
19
|
+
expect(page).to have_css(".fa-check")
|
20
|
+
end
|
21
|
+
|
22
|
+
Given(/^an existing expense category$/) do
|
23
|
+
@category = create(:expense_gun_category, vat_deductible: true)
|
24
|
+
end
|
25
|
+
|
26
|
+
When(/^I edit the expense category$/) do
|
27
|
+
visit dorsale.expense_gun_categories_path
|
28
|
+
find(".link_update").click
|
29
|
+
end
|
30
|
+
|
31
|
+
Then(/^the current expense category's label should be pre\-filled$/) do
|
32
|
+
expect(page).to have_field("category_name", with: @category.name)
|
33
|
+
end
|
34
|
+
|
35
|
+
When(/^he validates the new expense category$/) do
|
36
|
+
fill_in "category_name", with: "New Category Name"
|
37
|
+
fill_in "category_code", with: "New Category Code"
|
38
|
+
select "Non"
|
39
|
+
find("[type=submit]").click
|
40
|
+
end
|
41
|
+
|
42
|
+
Then(/^he is redirected on the expense categories page$/) do
|
43
|
+
expect(current_path).to eq dorsale.expense_gun_categories_path
|
44
|
+
end
|
45
|
+
|
46
|
+
Then(/^the expense category's label is updated$/) do
|
47
|
+
expect(page).to have_content "New Category Name"
|
48
|
+
expect(page).to have_content "New Category Code"
|
49
|
+
expect(page).to have_css(".fa-remove")
|
50
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
When(/^I go on the expenses page$/) do
|
2
|
+
visit dorsale.expense_gun_expenses_path
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^I see (\d+) expenses?$/) do |n|
|
6
|
+
expect(page).to have_selector(".expense", count: n.to_i)
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I create a new expense$/) do
|
10
|
+
@expenses_count = Dorsale::ExpenseGun::Expense.count
|
11
|
+
@expense_lines_count = Dorsale::ExpenseGun::ExpenseLine.count
|
12
|
+
|
13
|
+
find("[href$='expenses/new']").click
|
14
|
+
fill_in :expense_name, with: "ExpenseName"
|
15
|
+
|
16
|
+
within all(".nested-fields").first do
|
17
|
+
find("input[id$='_name']").set "ExpenseLine1Name"
|
18
|
+
find("input[id$='_date']").set "2015-06-21"
|
19
|
+
select @category.name
|
20
|
+
find("input[id$='_total_all_taxes']").set "100"
|
21
|
+
find("input[id$='_vat']").set "20"
|
22
|
+
end
|
23
|
+
|
24
|
+
find(".add_fields").click
|
25
|
+
expect(page).to have_selector(".nested-fields", count: 2)
|
26
|
+
|
27
|
+
within all(".nested-fields").last do
|
28
|
+
find("input[id$='_name']").set "ExpenseLine2Name"
|
29
|
+
find("input[id$='_date']").set "2015-06-12"
|
30
|
+
select @category.name
|
31
|
+
find("input[id$='_total_all_taxes']").set "200"
|
32
|
+
find("input[id$='_vat']").set "40"
|
33
|
+
end
|
34
|
+
|
35
|
+
find("[type=submit]").click
|
36
|
+
end
|
37
|
+
|
38
|
+
Then(/^the expense is created$/) do
|
39
|
+
expect(Dorsale::ExpenseGun::Expense.count).to eq(@expenses_count + 1)
|
40
|
+
expect(Dorsale::ExpenseGun::ExpenseLine.count).to eq(@expense_lines_count + 2)
|
41
|
+
|
42
|
+
@expense = Dorsale::ExpenseGun::Expense.last_created
|
43
|
+
|
44
|
+
expect(@expense.name).to eq "ExpenseName"
|
45
|
+
expect(@expense.expense_lines.first.name).to eq "ExpenseLine1Name"
|
46
|
+
end
|
47
|
+
|
48
|
+
Then(/^I am redirected on the expense page$/) do
|
49
|
+
expect(current_path).to eq dorsale.expense_gun_expense_path(@expense)
|
50
|
+
end
|
51
|
+
|
52
|
+
Then(/^I see (\d+) expense lines?$/) do |n|
|
53
|
+
expect(page).to have_selector(".expense-line", count: n.to_i)
|
54
|
+
end
|
55
|
+
|
56
|
+
Given(/^an existing expense$/) do
|
57
|
+
@expense = create(:expense_gun_expense)
|
58
|
+
end
|
59
|
+
|
60
|
+
When(/^I update the expense$/) do
|
61
|
+
@expenses_count = Dorsale::ExpenseGun::Expense.count
|
62
|
+
@expense_lines_count = Dorsale::ExpenseGun::ExpenseLine.count
|
63
|
+
|
64
|
+
find("#main [href$=edit]").click
|
65
|
+
|
66
|
+
fill_in :expense_name, with: "NewExpenseName"
|
67
|
+
all(".remove_fields").sample.click
|
68
|
+
|
69
|
+
find("[type=submit]").click
|
70
|
+
end
|
71
|
+
|
72
|
+
Then(/^the expense is update$/) do
|
73
|
+
expect(Dorsale::ExpenseGun::Expense.count).to eq(@expenses_count)
|
74
|
+
expect(Dorsale::ExpenseGun::ExpenseLine.count).to eq(@expense_lines_count - 1)
|
75
|
+
|
76
|
+
@expense.reload
|
77
|
+
|
78
|
+
expect(@expense.name).to eq "NewExpenseName"
|
79
|
+
end
|
80
|
+
|
81
|
+
When(/^I submit the expense$/) do
|
82
|
+
find("[href$='/submit']").click
|
83
|
+
end
|
84
|
+
|
85
|
+
Then(/^I am redirect to the expenses page$/) do
|
86
|
+
wait_for { current_path }.to eq dorsale.expense_gun_expenses_path
|
87
|
+
end
|
88
|
+
|
89
|
+
Then(/^the expense state is "([^"]*)"$/) do |new_state|
|
90
|
+
expect(@expense.reload.state).to eq new_state
|
91
|
+
end
|
92
|
+
|
93
|
+
Given(/^the expense is submitted$/) do
|
94
|
+
@expense.update_columns(state: "submitted")
|
95
|
+
end
|
96
|
+
|
97
|
+
When(/^I cancel the expense$/) do
|
98
|
+
find("[href$='/cancel']").click
|
99
|
+
end
|
100
|
+
|
101
|
+
When(/^I accept the expense$/) do
|
102
|
+
find("[href$='/accept']").click
|
103
|
+
end
|
104
|
+
|
105
|
+
When(/^I refuse the expense$/) do
|
106
|
+
find("[href$='/refuse']").click
|
107
|
+
end
|
108
|
+
|
109
|
+
Then(/^I am redirect to the expense page$/) do
|
110
|
+
wait_for { current_path }.to include dorsale.expense_gun_expense_path(@expense)
|
111
|
+
end
|
112
|
+
|
113
|
+
When(/^I go on the expense page$/) do
|
114
|
+
visit dorsale.expense_gun_expense_path(@expense)
|
115
|
+
end
|
116
|
+
|
117
|
+
When(/^I copy the expense$/) do
|
118
|
+
@expenses_count = Dorsale::ExpenseGun::Expense.count
|
119
|
+
|
120
|
+
find("[href$=copy]").click
|
121
|
+
expect(page).to have_selector("form#new_expense [type=submit]")
|
122
|
+
|
123
|
+
all(".nested-fields").each do |line|
|
124
|
+
within line do
|
125
|
+
find("input[id$='_date']").set "12/06/2015"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
find("form#new_expense [type=submit]").click
|
130
|
+
end
|
131
|
+
|
132
|
+
Then(/^an expense copy is created$/) do
|
133
|
+
expect(Dorsale::ExpenseGun::Expense.count).to eq(@expenses_count + 1)
|
134
|
+
@expense = Dorsale::ExpenseGun::Expense.last_created
|
135
|
+
end
|