dorsale 3.8.1 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +5 -1
  4. data/app/commands/dorsale/flyboy/task_commands.rb +1 -1
  5. data/app/controllers/concerns/dorsale/flyboy/tasks_summary_concern.rb +0 -1
  6. data/app/controllers/dorsale/alexandrie/attachments_controller.rb +1 -2
  7. data/app/controllers/dorsale/application_controller.rb +0 -1
  8. data/app/controllers/dorsale/billing_machine/application_controller.rb +0 -2
  9. data/app/controllers/dorsale/billing_machine/invoices_controller.rb +9 -22
  10. data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +0 -1
  11. data/app/controllers/dorsale/billing_machine/quotations_controller.rb +1 -4
  12. data/app/controllers/dorsale/comments_controller.rb +3 -2
  13. data/app/controllers/dorsale/customer_vault/activity_types_controller.rb +0 -1
  14. data/app/controllers/dorsale/customer_vault/application_controller.rb +0 -1
  15. data/app/controllers/dorsale/customer_vault/links_controller.rb +22 -12
  16. data/app/controllers/dorsale/customer_vault/origins_controller.rb +0 -1
  17. data/app/controllers/dorsale/customer_vault/people_controller.rb +2 -3
  18. data/app/controllers/dorsale/expense_gun/categories_controller.rb +0 -1
  19. data/app/controllers/dorsale/expense_gun/expenses_controller.rb +0 -1
  20. data/app/controllers/dorsale/flyboy/task_comments_controller.rb +0 -1
  21. data/app/controllers/dorsale/flyboy/tasks_controller.rb +28 -21
  22. data/app/controllers/dorsale/users_controller.rb +0 -1
  23. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +9 -5
  24. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb +2 -2
  25. data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
  26. data/app/helpers/dorsale/billing_machine/application_helper.rb +6 -6
  27. data/app/helpers/dorsale/context_helper.rb +1 -1
  28. data/app/helpers/dorsale/flyboy/application_helper.rb +4 -5
  29. data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +0 -1
  30. data/app/mailers/dorsale/flyboy/task_mailer.rb +0 -1
  31. data/app/mailers/dorsale/user_mailer.rb +0 -1
  32. data/app/models/dorsale/address.rb +2 -2
  33. data/app/models/dorsale/alexandrie/attachment_type.rb +0 -1
  34. data/app/models/dorsale/billing_machine.rb +1 -2
  35. data/app/models/dorsale/billing_machine/invoice.rb +19 -30
  36. data/app/models/dorsale/billing_machine/invoice_line.rb +2 -2
  37. data/app/models/dorsale/billing_machine/quotation.rb +11 -17
  38. data/app/models/dorsale/billing_machine/quotation_line.rb +2 -3
  39. data/app/models/dorsale/comment.rb +1 -1
  40. data/app/models/dorsale/customer_vault/corporation.rb +11 -10
  41. data/app/models/dorsale/customer_vault/event.rb +2 -2
  42. data/app/models/dorsale/customer_vault/individual.rb +4 -2
  43. data/app/models/dorsale/customer_vault/person.rb +14 -4
  44. data/app/models/dorsale/customer_vault/person_data.rb +1 -2
  45. data/app/models/dorsale/expense_gun/expense.rb +2 -5
  46. data/app/models/dorsale/expense_gun/expense_line.rb +2 -2
  47. data/app/models/dorsale/flyboy/task.rb +17 -18
  48. data/app/models/dorsale/flyboy/task_comment.rb +1 -1
  49. data/app/models/dorsale/users/active.rb +1 -1
  50. data/app/models/dorsale/users/avatar.rb +2 -1
  51. data/app/models/dorsale/users/password_generation.rb +0 -1
  52. data/app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb +1 -1
  53. data/app/pdfs/dorsale/application_pdf.rb +7 -0
  54. data/app/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf.rb +52 -47
  55. data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +94 -205
  56. data/app/pdfs/dorsale/prawn_helpers.rb +107 -0
  57. data/app/policies/dorsale/application_policy.rb +2 -4
  58. data/app/policies/dorsale/expense_gun/expense_policy_helper.rb +0 -1
  59. data/app/policies/dorsale/flyboy/task_policy_helper.rb +3 -3
  60. data/app/policies/dorsale/policy_checker.rb +11 -18
  61. data/app/services/dorsale/billing_machine/invoice/copy.rb +2 -2
  62. data/app/services/dorsale/billing_machine/pdf_file_generator.rb +7 -2
  63. data/app/services/dorsale/billing_machine/quotation/copy.rb +1 -1
  64. data/app/services/dorsale/billing_machine/quotation/to_invoice.rb +10 -7
  65. data/app/services/dorsale/flyboy/task/snoozer.rb +1 -1
  66. data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -2
  67. data/app/views/dorsale/billing_machine/invoices/_form.html.slim +4 -11
  68. data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +1 -1
  69. data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +1 -1
  70. data/config/locales/alexandrie.en.yml +0 -4
  71. data/config/locales/alexandrie.fr.yml +0 -4
  72. data/config/locales/billing_machine.en.yml +0 -41
  73. data/config/locales/billing_machine.fr.yml +0 -41
  74. data/config/routes.rb +0 -1
  75. data/db/migrate/20161119064536_delete_id_cards.rb +9 -0
  76. data/features/billing_machine_invoices.feature +0 -1
  77. data/features/billing_machine_multiple_vat.feature +0 -1
  78. data/features/billing_machine_quotations.feature +0 -1
  79. data/features/step_definitions/billing_machine_invoices_steps.rb +73 -79
  80. data/features/step_definitions/billing_machine_multiple_vat.rb +5 -6
  81. data/features/step_definitions/billing_machine_payment_terms_steps.rb +2 -2
  82. data/features/step_definitions/billing_machine_quotations_steps.rb +45 -80
  83. data/features/step_definitions/common_steps.rb +0 -4
  84. data/features/step_definitions/customer_vault_activity_types_steps.rb +1 -1
  85. data/features/step_definitions/customer_vault_corporations_steps.rb +27 -23
  86. data/features/step_definitions/customer_vault_individuals_steps.rb +8 -9
  87. data/features/step_definitions/customer_vault_invoices_steps.rb +1 -1
  88. data/features/step_definitions/customer_vault_links_steps.rb +6 -6
  89. data/features/step_definitions/customer_vault_origins_steps.rb +1 -1
  90. data/features/step_definitions/customer_vault_people_steps.rb +2 -1
  91. data/features/step_definitions/expense_gun_categories_steps.rb +2 -2
  92. data/features/step_definitions/expense_gun_expenses_steps.rb +6 -6
  93. data/features/step_definitions/flyboy_tasks_steps.rb +4 -7
  94. data/features/step_definitions/tasks_summary_steps.rb +3 -3
  95. data/features/support/env.rb +3 -2
  96. data/lib/dorsale/engine.rb +8 -8
  97. data/lib/dorsale/file_loader.rb +1 -1
  98. data/lib/dorsale/simple_form.rb +3 -3
  99. data/lib/dorsale/simple_form_bootstrap.rb +46 -46
  100. data/lib/dorsale/version.rb +1 -1
  101. data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +3 -3
  102. data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +0 -1
  103. data/spec/controllers/dorsale/comments_controller_spec.rb +1 -1
  104. data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +9 -9
  105. data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +15 -19
  106. data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +1 -2
  107. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +43 -19
  108. data/spec/factories/alexandrie_attachment_types.rb +1 -1
  109. data/spec/factories/alexandrie_attachments.rb +1 -1
  110. data/spec/factories/billing_machine_invoice_lines.rb +1 -1
  111. data/spec/factories/billing_machine_invoices.rb +1 -2
  112. data/spec/factories/billing_machine_payment_terms.rb +1 -1
  113. data/spec/factories/billing_machine_quotation_lines.rb +1 -2
  114. data/spec/factories/billing_machine_quotations.rb +1 -2
  115. data/spec/factories/customer_vault_activity_types.rb +1 -1
  116. data/spec/factories/customer_vault_corporations.rb +1 -1
  117. data/spec/factories/customer_vault_event.rb +1 -1
  118. data/spec/factories/customer_vault_individuals.rb +2 -2
  119. data/spec/factories/customer_vault_links.rb +1 -1
  120. data/spec/factories/customer_vault_origins.rb +1 -1
  121. data/spec/factories/dorsale_addresses.rb +1 -1
  122. data/spec/factories/dorsale_comments.rb +1 -1
  123. data/spec/factories/expense_gun_categories.rb +2 -2
  124. data/spec/factories/expense_gun_expense_lines.rb +8 -8
  125. data/spec/factories/expense_gun_expenses.rb +2 -3
  126. data/spec/factories/flyboy_task_comments.rb +1 -1
  127. data/spec/factories/flyboy_tasks.rb +1 -1
  128. data/spec/mailers/user_mailer.rb +5 -6
  129. data/spec/models/dorsale/address_spec.rb +26 -26
  130. data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +6 -6
  131. data/spec/models/dorsale/billing_machine/invoice_spec.rb +37 -23
  132. data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +9 -10
  133. data/spec/models/dorsale/billing_machine/quotation_spec.rb +26 -28
  134. data/spec/models/dorsale/billing_machine_spec.rb +0 -1
  135. data/spec/models/dorsale/comment_spec.rb +0 -1
  136. data/spec/models/dorsale/customer_vault/corporation_spec.rb +20 -20
  137. data/spec/models/dorsale/customer_vault/event_spec.rb +1 -1
  138. data/spec/models/dorsale/customer_vault/individual_spec.rb +0 -2
  139. data/spec/models/dorsale/customer_vault/link_spec.rb +0 -1
  140. data/spec/models/dorsale/customer_vault/person_spec.rb +7 -6
  141. data/spec/models/dorsale/expense_gun/category_spec.rb +2 -2
  142. data/spec/models/dorsale/expense_gun/expense_line_spec.rb +14 -14
  143. data/spec/models/dorsale/expense_gun/expense_spec.rb +23 -13
  144. data/spec/models/dorsale/flyboy/task_comment_spec.rb +5 -6
  145. data/spec/models/dorsale/flyboy/task_spec.rb +66 -42
  146. data/spec/models/dorsale/users_spec.rb +3 -5
  147. data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +6 -11
  148. data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +7 -11
  149. data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +6 -11
  150. data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +7 -14
  151. data/spec/rails_helper.rb +1 -1
  152. data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +0 -1
  153. data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +0 -1
  154. data/spec/routing/dorsale/comments_routing_spec.rb +0 -2
  155. data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +0 -1
  156. data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +0 -1
  157. data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +0 -1
  158. data/spec/routing/dorsale/users_routing_spec.rb +1 -1
  159. data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +2 -2
  160. data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +13 -17
  161. data/spec/services/dorsale/flyboy/task/copy_spec.rb +1 -2
  162. data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +3 -3
  163. data/spec/spec_helper.rb +1 -0
  164. metadata +5 -43
  165. data/app/controllers/dorsale/billing_machine/id_cards_controller.rb +0 -106
  166. data/app/models/dorsale/billing_machine/id_card.rb +0 -14
  167. data/app/policies/dorsale/billing_machine/id_card_policy_helper.rb +0 -7
  168. data/app/views/dorsale/billing_machine/id_cards/_form.html.slim +0 -42
  169. data/app/views/dorsale/billing_machine/id_cards/_index_actions.html.slim +0 -2
  170. data/app/views/dorsale/billing_machine/id_cards/_list.html.slim +0 -27
  171. data/app/views/dorsale/billing_machine/id_cards/edit.html.slim +0 -1
  172. data/app/views/dorsale/billing_machine/id_cards/index.html.slim +0 -11
  173. data/app/views/dorsale/billing_machine/id_cards/new.html.slim +0 -1
  174. data/features/billing_machine_id_cards.feature +0 -19
  175. data/features/step_definitions/billing_machine_id_cards_steps.rb +0 -53
  176. data/features/support/ajax.rb +0 -20
  177. data/features/support/database_cleaner.rb +0 -12
  178. data/features/support/factory_girl.rb +0 -1
  179. data/features/support/fix_referrer.rb +0 -9
  180. data/features/support/message_delivery.rb +0 -1
  181. data/features/support/poltergeist.rb +0 -22
  182. data/features/support/rails.rb +0 -1
  183. data/features/support/rspec.rb +0 -6
  184. data/features/support/screenshots.rb +0 -5
  185. data/features/support/sign_in.rb +0 -17
  186. data/features/support/simplecov.rb +0 -1
  187. data/features/support/turbolinks.rb +0 -30
  188. data/spec/factories/billing_machine_id_cards.rb +0 -26
  189. data/spec/models/dorsale/billing_machine/id_card_spec.rb +0 -12
@@ -1,106 +0,0 @@
1
- class Dorsale::BillingMachine::IdCardsController < ::Dorsale::BillingMachine::ApplicationController
2
- before_action :set_objects, only: [:edit, :update]
3
-
4
- def index
5
- authorize model, :list?
6
-
7
- @id_cards ||= scope.all
8
- end
9
-
10
- def new
11
- @id_card ||= scope.new
12
-
13
- authorize @id_card, :create?
14
- end
15
-
16
- def create
17
- @id_card ||= scope.new(id_card_params_for_create)
18
-
19
- authorize @id_card, :create?
20
-
21
- if @id_card.save
22
- flash[:notice] = t("id_cards.create_ok")
23
- redirect_to back_url
24
- else
25
- render action: :new
26
- end
27
- end
28
-
29
- def edit
30
- authorize @id_card, :update?
31
- end
32
-
33
- def update
34
- authorize @id_card, :update?
35
-
36
- if @id_card.update(id_card_params_for_update)
37
- flash[:notice] = t("id_cards.update_ok")
38
- redirect_to back_url
39
- else
40
- render action: :edit
41
- end
42
- end
43
-
44
- private
45
-
46
- def set_objects
47
- @id_card ||= scope.find(params[:id])
48
- end
49
-
50
- def model
51
- ::Dorsale::BillingMachine::IdCard
52
- end
53
-
54
- def back_url
55
- url_for(action: :index, id: nil)
56
- end
57
-
58
- def permitted_params
59
- [
60
- :id,
61
- :id_card_name,
62
- :entity_name,
63
- :siret,
64
- :legal_form,
65
- :capital,
66
- :registration_number,
67
- :intracommunity_vat,
68
- :address1,
69
- :address2,
70
- :zip,
71
- :city,
72
- :phone,
73
- :contact_full_name,
74
- :contact_phone,
75
- :contact_address_1,
76
- :contact_address_2,
77
- :contact_zip,
78
- :contact_city,
79
- :iban,
80
- :bic_swift,
81
- :bank_name,
82
- :bank_address,
83
- :ape_naf,
84
- :custom_info_1,
85
- :custom_info_2,
86
- :custom_info_3,
87
- :contact_fax,
88
- :contact_email,
89
- :logo,
90
- :registration_city,
91
- ]
92
- end
93
-
94
- def id_card_params
95
- params.fetch(:billing_machine_id_card, {}).permit(permitted_params)
96
- end
97
-
98
- def id_card_params_for_create
99
- id_card_params
100
- end
101
-
102
- def id_card_params_for_update
103
- id_card_params
104
- end
105
-
106
- end
@@ -1,14 +0,0 @@
1
- class Dorsale::BillingMachine::IdCard < ::Dorsale::ApplicationRecord
2
- self.table_name = "dorsale_billing_machine_id_cards"
3
-
4
- has_many :invoices
5
- has_many :quotations
6
-
7
- validates :id_card_name, presence: true
8
-
9
- def name
10
- id_card_name
11
- end
12
-
13
- mount_uploader :logo, ::Dorsale::ImageUploader
14
- end
@@ -1,7 +0,0 @@
1
- module Dorsale::BillingMachine::IdCardPolicyHelper
2
- POLICY_METHODS = [
3
- :list?,
4
- :create?,
5
- :update?,
6
- ]
7
- end
@@ -1,42 +0,0 @@
1
- .panel.panel-default
2
- .panel-heading: .panel-title
3
- - if @id_card.new_record?
4
- = t("actions.new_id_card")
5
- - else
6
- = t("actions.update")
7
- = " : "
8
- = @id_card
9
-
10
- .panel-body
11
- = horizontal_form_for @id_card do |f|
12
- = f.input :id_card_name
13
- = f.input :entity_name
14
- = f.input :siret
15
- = f.input :legal_form
16
- = f.input :capital
17
- = f.input :registration_number
18
- = f.input :intracommunity_vat
19
- = f.input :address1
20
- = f.input :address2
21
- = f.input :zip
22
- = f.input :city
23
- = f.input :phone
24
- = f.input :contact_full_name
25
- = f.input :contact_phone
26
- = f.input :contact_address_1
27
- = f.input :contact_address_2
28
- = f.input :contact_zip
29
- = f.input :contact_city
30
- = f.input :iban
31
- = f.input :bic_swift
32
- = f.input :bank_name
33
- = f.input :bank_address
34
- = f.input :ape_naf
35
- = f.input :custom_info_1
36
- = f.input :custom_info_2
37
- = f.input :custom_info_3
38
- = f.input :contact_fax
39
- = f.input :contact_email
40
- = f.input :logo, wrapper: :horizontal_form
41
- = f.input :registration_city
42
- = form_buttons
@@ -1,2 +0,0 @@
1
- - if policy(::Dorsale::BillingMachine::IdCard).create?
2
- = create_button new_billing_machine_id_card_path, action: :create
@@ -1,27 +0,0 @@
1
- table.table.default#id_card
2
- thead
3
- tr
4
- th.actions.id_card-id_card_name
5
- = ::Dorsale::BillingMachine::IdCard.t(:id_card_name)
6
- th.actions.id_card-entity_name
7
- = ::Dorsale::BillingMachine::IdCard.t(:entity_name)
8
- th.actions.id_card-contact_full_name
9
- = ::Dorsale::BillingMachine::IdCard.t(:contact_full_name)
10
- th.actions.id_card-action
11
- = "Action"
12
-
13
- tbody
14
- - @id_cards.each do |id_card|
15
- tr.actions.id_card
16
- td.actions.id_card-id_card_name
17
- = id_card.id_card_name
18
-
19
- td.actions.id_card-entity_name
20
- = id_card.entity_name
21
-
22
- td.actions.id_card-contact_full_name
23
- = id_card.contact_full_name
24
-
25
- td.actions.id_card-action
26
- - if policy(id_card).update?
27
- = update_button edit_billing_machine_id_card_path(id_card), id: "edit-#{id_card.id}"
@@ -1,11 +0,0 @@
1
- .billing_machine
2
- - content_for :title
3
- = ::Dorsale::BillingMachine::IdCard.ts
4
-
5
- - content_for :actions
6
- = render "dorsale/billing_machine/id_cards/index_actions"
7
-
8
- - content_for :table
9
- = render "dorsale/billing_machine/id_cards/list", id_cards: @id_cards
10
-
11
- = render_dorsale_page
@@ -1,19 +0,0 @@
1
- @javascript
2
- Feature: IdCards
3
-
4
- Scenario: New id_card
5
- Given an authenticated user
6
- And the user goes on the new id_card page
7
- When he fills the id_card's information
8
- And creates a new id_card
9
- Then he is redirected on the id_cards page
10
- And the id_card is added to the id_card list
11
-
12
- Scenario: Update id_card
13
- Given an authenticated user
14
- And an existing id_card
15
- When the user edits the id_card
16
- Then the current id_card's label should be pre-filled
17
- When he validates the new id_card
18
- Then he is redirected on the id_cards page
19
- And the id_card's label is updated
@@ -1,53 +0,0 @@
1
- Given(/^the user goes on the new id_card page$/) do
2
- visit dorsale.billing_machine_id_cards_path
3
- find(".link_create").click
4
- end
5
-
6
- Given(/^an existing id_card$/) do
7
- @id_card = create(:billing_machine_id_card)
8
- end
9
-
10
- When(/^he fills the id_card's information$/) do
11
- fill_in 'billing_machine_id_card_id_card_name', with: "Id Card name"
12
- fill_in 'billing_machine_id_card_entity_name', with: "Id Card entity name"
13
- fill_in 'billing_machine_id_card_contact_full_name', with: "Id Card contact full name"
14
- end
15
-
16
- When(/^creates a new id_card$/) do
17
- find("[type=submit]").click
18
- end
19
-
20
- Then(/^he is redirected on the id_cards page$/) do
21
- expect(current_path).to eq dorsale.billing_machine_id_cards_path
22
- end
23
-
24
- Then(/^the id_card is added to the id_card list$/) do
25
- expect(page).to have_content "Id Card name"
26
- expect(page).to have_content "Id Card entity name"
27
- expect(page).to have_content "Id Card contact full name"
28
-
29
- end
30
-
31
- Then(/^the current id_card's label should be pre\-filled$/) do
32
- expect(page).to have_field("billing_machine_id_card_id_card_name", with: @id_card.id_card_name)
33
- expect(page).to have_field("billing_machine_id_card_entity_name", with: @id_card.entity_name)
34
- expect(page).to have_field("billing_machine_id_card_contact_full_name", with: @id_card.contact_full_name)
35
- end
36
-
37
- When(/^the user edits the id_card$/) do
38
- visit dorsale.billing_machine_id_cards_path
39
- find(".link_update").click
40
- end
41
-
42
- When(/^he validates the new id_card$/) do
43
- fill_in "billing_machine_id_card_id_card_name", with: "New Id Card Name"
44
- fill_in "billing_machine_id_card_entity_name", with: "New Id Card Entity Name"
45
- fill_in "billing_machine_id_card_contact_full_name", with: "New Id Card Contact Full Name"
46
- find("[type=submit]").click
47
- end
48
-
49
- Then(/^the id_card's label is updated$/) do
50
- expect(page).to have_content "New Id Card Name"
51
- expect(page).to have_content "New Id Card Entity Name"
52
- expect(page).to have_content "New Id Card Contact Full Name"
53
- end
@@ -1,20 +0,0 @@
1
- module CucumberWaitAjaxRequests
2
- def wait_ajax_requests(timeout = Capybara.default_max_wait_time)
3
- Timeout.timeout(timeout) do
4
- sleep 0.1 until all_ajax_requests_finished?
5
- end
6
- end
7
-
8
- def all_ajax_requests_finished?
9
- page.evaluate_script('jQuery.active').zero?
10
- end
11
- end
12
-
13
- World(CucumberWaitAjaxRequests)
14
-
15
- # Auto wait ajax request between steps
16
- AfterStep do |scenario|
17
- if page.evaluate_script('typeof jQuery') != "undefined"
18
- wait_ajax_requests
19
- end
20
- end
@@ -1,12 +0,0 @@
1
- require 'database_cleaner'
2
-
3
- Cucumber::Rails::Database.autorun_database_cleaner = false
4
- Cucumber::Rails::Database.javascript_strategy = :truncation
5
-
6
- After do |scenario, block|
7
- DatabaseCleaner.clean_with(:truncation, {except: %w(
8
- ar_internal_metadata
9
- schema_migrations
10
- spatial_ref_sys
11
- )})
12
- end
@@ -1 +0,0 @@
1
- World(FactoryGirl::Syntax::Methods)
@@ -1,9 +0,0 @@
1
- # https://github.com/ariya/phantomjs/issues/13677
2
-
3
- module RackETagDisable
4
- def call(env)
5
- @app.call(env)
6
- end
7
- end
8
-
9
- Rack::ETag.send(:prepend, RackETagDisable)
@@ -1 +0,0 @@
1
- require Rails.root.join("../../spec/support/message_delivery.rb").to_s
@@ -1,22 +0,0 @@
1
- require "capybara/poltergeist"
2
-
3
- phantomjs_version = "2.1.1"
4
- phantomjs_binary = `which phantomjs-#{phantomjs_version} phantomjs`.split("\n").first
5
- raise "invalid phantomjs version" unless `#{phantomjs_binary} -v`.strip == phantomjs_version
6
- # You can download phantomjs here : https://bitbucket.org/ariya/phantomjs/downloads/
7
- # Semaphore setup commmand : change-phantomjs-version 2.1.1
8
-
9
- Capybara.register_driver :poltergeist do |app|
10
- Capybara::Poltergeist::Driver.new(app,
11
- :debug => false,
12
- :window_size => [1680, 1050],
13
- :timeout => 60,
14
- :phantomjs => phantomjs_binary,
15
- :js_errors => false,
16
- )
17
- end
18
-
19
- Capybara.default_driver = :poltergeist
20
- Capybara.javascript_driver = :poltergeist
21
- Capybara.current_driver = :poltergeist
22
- Capybara.default_max_wait_time = 5
@@ -1 +0,0 @@
1
- ActionController::Base.allow_rescue = false
@@ -1,6 +0,0 @@
1
- # mocks
2
- require 'cucumber/rspec/doubles'
3
-
4
- # wait_for { ... }.to eq(...)
5
- require "rspec/wait"
6
- World(RSpec::Wait)
@@ -1,5 +0,0 @@
1
- After do |scenario|
2
- if scenario.failed?
3
- page.save_screenshot(scenario.name.parameterize + ".png")
4
- end
5
- end
@@ -1,17 +0,0 @@
1
- module CucumberSignIn
2
- include Warden::Test::Helpers
3
-
4
- def sign_out
5
- logout
6
- end
7
-
8
- def sign_in(user)
9
- sign_out
10
- visit(new_user_session_path)
11
- fill_in "user_email", with: user.email
12
- fill_in "user_password", with: user.password
13
- find("[type=submit]").click
14
- end
15
- end
16
-
17
- World(CucumberSignIn)
@@ -1 +0,0 @@
1
- # require "simplecov"
@@ -1,30 +0,0 @@
1
- module CucumberWaitTurbolinksRequests
2
- def wait_turbolinks_requests(timeout = Capybara.default_max_wait_time)
3
- Timeout.timeout(timeout) do
4
- sleep 0.1 until all_turbolinks_requests_finished?
5
- end
6
- end
7
-
8
- def all_turbolinks_requests_finished?
9
- have_no_selector("html.turbolinks-load")
10
- end
11
- end
12
-
13
- World(CucumberWaitTurbolinksRequests)
14
-
15
- # Auto wait turbolinks requests between steps
16
- AfterStep do |scenario|
17
- if page.evaluate_script('typeof Turbolinks') != "undefined"
18
- evaluate_script %(
19
- $(document).on("turbolinks:before-visit", function(){
20
- $("html").addClass("turbolinks-load")
21
- })
22
-
23
- $(document).on("turbolinks:load", function(){
24
- $("html").removeClass("turbolinks-load")
25
- })
26
- )
27
-
28
- wait_turbolinks_requests
29
- end
30
- end