dorsale 1.2.6 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/accounting.js +413 -0
- data/app/assets/javascripts/dorsale/billing_machine/all.coffee +20 -0
- data/app/assets/javascripts/dorsale/billing_machine/invoices.coffee +39 -0
- data/app/assets/javascripts/dorsale/billing_machine/quotations.coffee +38 -0
- data/app/assets/javascripts/dorsale/comments.coffee +4 -0
- data/app/assets/javascripts/dorsale/customer_vault/all.coffee +9 -0
- data/app/assets/javascripts/dorsale/datepicker.coffee +1 -1
- data/app/assets/javascripts/dorsale/flyboy/all.coffee +0 -0
- data/app/assets/javascripts/dorsale/forms.coffee +20 -6
- data/app/assets/stylesheets/dorsale/billing_machine/all.sass +15 -0
- data/app/assets/stylesheets/dorsale/bootstrap_nav_left.sass +34 -0
- data/app/assets/stylesheets/dorsale/comments.sass +25 -3
- data/app/assets/stylesheets/dorsale/customer_vault/all.sass +89 -0
- data/app/assets/stylesheets/dorsale/filters.sass +4 -1
- data/app/assets/stylesheets/dorsale/flyboy/all.sass +52 -0
- data/app/assets/stylesheets/dorsale/forms.sass +19 -0
- data/app/controllers/dorsale/alexandrie/attachments_controller.rb +52 -0
- data/app/controllers/dorsale/billing_machine/application_controller.rb +15 -0
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +180 -0
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +151 -0
- data/app/controllers/dorsale/comments_controller.rb +64 -17
- data/app/controllers/dorsale/customer_vault/application_controller.rb +26 -0
- data/app/controllers/dorsale/customer_vault/corporations_controller.rb +100 -0
- data/app/controllers/dorsale/customer_vault/individuals_controller.rb +104 -0
- data/app/controllers/dorsale/customer_vault/links_controller.rb +92 -0
- data/app/controllers/dorsale/customer_vault/people_controller.rb +42 -0
- data/app/controllers/dorsale/flyboy/application_controller.rb +9 -0
- data/app/controllers/dorsale/flyboy/folders_controller.rb +124 -0
- data/app/controllers/dorsale/flyboy/task_comments_controller.rb +29 -0
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +171 -0
- data/app/controllers/dorsale/small_data/filters_controller.rb +7 -0
- data/app/helpers/dorsale/alexandrie/attachments_helper.rb +17 -0
- data/app/helpers/dorsale/all_helpers.rb +12 -9
- data/app/helpers/dorsale/button_helper.rb +23 -3
- data/app/helpers/dorsale/comments_helper.rb +4 -0
- data/app/helpers/dorsale/customer_vault/application_helper.rb +98 -0
- data/app/helpers/dorsale/flyboy/application_helper.rb +44 -0
- data/app/helpers/dorsale/form_helper.rb +7 -0
- data/app/helpers/dorsale/link_helper.rb +3 -2
- data/app/helpers/dorsale/routes_helper.rb +5 -3
- data/app/helpers/dorsale/text_helper.rb +28 -1
- data/app/models/dorsale/ability_helper.rb +7 -0
- data/app/models/dorsale/alexandrie/ability_helper.rb +9 -0
- data/app/models/dorsale/alexandrie/attachment.rb +18 -0
- data/app/models/dorsale/billing_machine/ability_helper.rb +10 -0
- data/app/models/dorsale/billing_machine/id_card.rb +18 -0
- data/app/models/dorsale/billing_machine/invoice.rb +126 -0
- data/app/models/dorsale/billing_machine/invoice_line.rb +27 -0
- data/app/models/dorsale/billing_machine/payment_term.rb +12 -0
- data/app/models/dorsale/billing_machine/quotation.rb +66 -0
- data/app/models/dorsale/billing_machine/quotation_line.rb +25 -0
- data/app/models/dorsale/billing_machine/small_data/filter_for_invoices.rb +21 -0
- data/app/models/dorsale/billing_machine/small_data/filter_for_quotations.rb +20 -0
- data/app/models/dorsale/billing_machine/small_data/filter_strategy_by_customer.rb +12 -0
- data/app/models/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +23 -0
- data/app/models/dorsale/billing_machine/small_data/filter_strategy_by_time_period.rb +27 -0
- data/app/models/dorsale/comment.rb +6 -2
- data/app/models/dorsale/customer_vault/ability_helper.rb +9 -0
- data/app/models/dorsale/customer_vault/corporation.rb +12 -0
- data/app/models/dorsale/customer_vault/individual.rb +17 -0
- data/app/models/dorsale/customer_vault/link.rb +10 -0
- data/app/models/dorsale/customer_vault/person.rb +35 -0
- data/app/models/dorsale/customer_vault/small_data/filter_for_people.rb +19 -0
- data/app/models/dorsale/customer_vault/small_data/filter_strategy_by_tags.rb +18 -0
- data/app/models/dorsale/flyboy/ability_helper.rb +41 -0
- data/app/models/dorsale/flyboy/folder.rb +77 -0
- data/app/models/dorsale/flyboy/small_data/filter_for_folders.rb +19 -0
- data/app/models/dorsale/flyboy/small_data/filter_for_tasks.rb +19 -0
- data/app/models/dorsale/flyboy/small_data/filter_strategy_by_done.rb +12 -0
- data/app/models/dorsale/flyboy/small_data/filter_strategy_by_nothing.rb +11 -0
- data/app/models/dorsale/flyboy/small_data/filter_strategy_by_status.rb +15 -0
- data/app/models/dorsale/flyboy/task.rb +97 -0
- data/app/models/dorsale/flyboy/task_comment.rb +35 -0
- data/app/pdfs/dorsale/billing_machine/invoice_pdf.rb +209 -0
- data/app/pdfs/dorsale/billing_machine/quotation_pdf.rb +53 -0
- data/app/pdfs/dorsale/flyboy/roadmap.rb +51 -0
- data/app/uploaders/dorsale/alexandrie/file_uploader.rb +6 -0
- data/app/uploaders/dorsale/file_uploader.rb +9 -0
- data/app/uploaders/dorsale/image_uploader.rb +7 -0
- data/app/views/dorsale/_contextual.html.slim +3 -0
- data/app/views/dorsale/alexandrie/attachments/_form.html.slim +13 -0
- data/app/views/dorsale/alexandrie/attachments/_form_and_list.html.slim +2 -0
- data/app/views/dorsale/alexandrie/attachments/_list.html.slim +7 -0
- data/app/views/dorsale/billing_machine/invoices/_data_context.html.slim +10 -0
- data/app/views/dorsale/billing_machine/invoices/_filters.html.slim +16 -0
- data/app/views/dorsale/billing_machine/invoices/_form.html.slim +62 -0
- data/app/views/dorsale/billing_machine/invoices/_line_fields.html.slim +23 -0
- data/app/views/dorsale/billing_machine/invoices/_list.html.slim +30 -0
- data/app/views/dorsale/billing_machine/invoices/edit.html.slim +2 -0
- data/app/views/dorsale/billing_machine/invoices/index.html.slim +15 -0
- data/app/views/dorsale/billing_machine/invoices/new.html.slim +2 -0
- data/app/views/dorsale/billing_machine/invoices/show.html.slim +53 -0
- data/app/views/dorsale/billing_machine/quotations/_data_context.html.slim +10 -0
- data/app/views/dorsale/billing_machine/quotations/_filters.html.slim +13 -0
- data/app/views/dorsale/billing_machine/quotations/_form.html.slim +55 -0
- data/app/views/dorsale/billing_machine/quotations/_line_fields.html.slim +23 -0
- data/app/views/dorsale/billing_machine/quotations/_list.html.slim +30 -0
- data/app/views/dorsale/billing_machine/quotations/edit.html.slim +2 -0
- data/app/views/dorsale/billing_machine/quotations/index.html.slim +14 -0
- data/app/views/dorsale/billing_machine/quotations/new.html.slim +2 -0
- data/app/views/dorsale/billing_machine/quotations/show.html.slim +61 -0
- data/app/views/dorsale/comments/_comment.html.slim +23 -9
- data/app/views/dorsale/comments/_comments.html.slim +2 -2
- data/app/views/dorsale/comments/_form.html.slim +1 -1
- data/app/views/dorsale/comments/_list.html.slim +2 -0
- data/app/views/dorsale/comments/edit.html.slim +5 -0
- data/app/views/dorsale/customer_vault/_breadcrumb.html.slim +4 -0
- data/app/views/dorsale/customer_vault/corporations/_context.html.slim +20 -0
- data/app/views/dorsale/customer_vault/corporations/_form.html.slim +21 -0
- data/app/views/dorsale/customer_vault/corporations/_list_details.html.slim +20 -0
- data/app/views/dorsale/customer_vault/corporations/edit.html.slim +14 -0
- data/app/views/dorsale/customer_vault/corporations/new.html.slim +14 -0
- data/app/views/dorsale/customer_vault/corporations/show.html.slim +1 -0
- data/app/views/dorsale/customer_vault/individuals/_context.html.slim +15 -0
- data/app/views/dorsale/customer_vault/individuals/_form.html.slim +22 -0
- data/app/views/dorsale/customer_vault/individuals/_list_details.html.slim +20 -0
- data/app/views/dorsale/customer_vault/individuals/edit.html.slim +14 -0
- data/app/views/dorsale/customer_vault/individuals/new.html.slim +14 -0
- data/app/views/dorsale/customer_vault/individuals/show.html.slim +1 -0
- data/app/views/dorsale/customer_vault/links/_title.html.slim +7 -0
- data/app/views/dorsale/customer_vault/links/edit.html.slim +19 -0
- data/app/views/dorsale/customer_vault/links/new.html.slim +15 -0
- data/app/views/dorsale/customer_vault/people/_activity_tab.html.slim +5 -0
- data/app/views/dorsale/customer_vault/people/_comment.html.slim +1 -0
- data/app/views/dorsale/customer_vault/people/_context.html.slim +4 -0
- data/app/views/dorsale/customer_vault/people/_data_context.html.slim +32 -0
- data/app/views/dorsale/customer_vault/people/_filters.html.slim +15 -0
- data/app/views/dorsale/customer_vault/people/_index_tabs.html.slim +7 -0
- data/app/views/dorsale/customer_vault/people/_links_tab.html.slim +16 -0
- data/app/views/dorsale/customer_vault/people/_new_people_contexts.html.slim +7 -0
- data/app/views/dorsale/customer_vault/people/_show.html.slim +31 -0
- data/app/views/dorsale/customer_vault/people/_tasks_tab.html.slim +1 -0
- data/app/views/dorsale/customer_vault/people/activity.slim +20 -0
- data/app/views/dorsale/customer_vault/people/list.html.slim +27 -0
- data/app/views/dorsale/flyboy/_filters.html.slim +12 -0
- data/app/views/dorsale/flyboy/folders/_actions.html.slim +15 -0
- data/app/views/dorsale/flyboy/folders/_context.html.slim +18 -0
- data/app/views/dorsale/flyboy/folders/_form.html.slim +22 -0
- data/app/views/dorsale/flyboy/folders/_list.html.slim +30 -0
- data/app/views/dorsale/flyboy/folders/edit.html.slim +2 -0
- data/app/views/dorsale/flyboy/folders/index.html.slim +8 -0
- data/app/views/dorsale/flyboy/folders/new.html.slim +2 -0
- data/app/views/dorsale/flyboy/folders/show.html.slim +9 -0
- data/app/views/dorsale/flyboy/task_comments/_list.html.slim +31 -0
- data/app/views/dorsale/flyboy/tasks/_actions.html.slim +9 -0
- data/app/views/dorsale/flyboy/tasks/_context.html.slim +15 -0
- data/app/views/dorsale/flyboy/tasks/_form.html.slim +29 -0
- data/app/views/dorsale/flyboy/tasks/_list.html.slim +43 -0
- data/app/views/dorsale/flyboy/tasks/_tasks_for_taskable.html.slim +6 -0
- data/app/views/dorsale/flyboy/tasks/edit.html.slim +2 -0
- data/app/views/dorsale/flyboy/tasks/index.html.slim +10 -0
- data/app/views/dorsale/flyboy/tasks/index.xls.erb +29 -0
- data/app/views/dorsale/flyboy/tasks/new.html.slim +2 -0
- data/app/views/dorsale/flyboy/tasks/show.html.slim +14 -0
- data/app/views/dorsale/search/_form.html.slim +6 -0
- data/config/locales/alexandrie.fr.yml +8 -0
- data/config/locales/billing_machine.fr.yml +50 -0
- data/config/locales/common.fr.yml +142 -0
- data/config/locales/customer_vault.fr.yml +69 -0
- data/config/locales/flyboy.fr.yml +66 -0
- data/config/locales/fr.yml +8 -87
- data/config/routes.rb +50 -1
- data/db/migrate/20141010140200_create_dorsale_addresses.rb +1 -1
- data/db/migrate/20150312083147_create_dorsale_comments.rb +3 -3
- data/db/migrate/20150616074852_create_dorsale_alexandrie_attachments.rb +9 -0
- data/db/migrate/20150622075000_create_flyboy.rb +50 -0
- data/db/migrate/20150622075038_create_billing_machine.rb +121 -0
- data/db/migrate/20150622105217_create_customer_vault.rb +49 -0
- data/db/migrate/20150623093218_dorsale_v2_changes.rb +68 -0
- data/db/migrate/20150625093326_billing_machine_quotations_add_expires_at.rb +5 -0
- data/db/migrate/20150625131155_billing_machine_add_tracking_ids.rb +6 -0
- data/lib/active_record_comma_type_cast.rb +12 -0
- data/lib/dorsale/alexandrie/prawn.rb +17 -0
- data/lib/dorsale/engine.rb +19 -0
- data/lib/dorsale/file_loader.rb +10 -0
- data/lib/dorsale/model_i18n.rb +21 -0
- data/lib/dorsale/model_to_s.rb +13 -0
- data/lib/dorsale/polymorphic_id.rb +2 -0
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +47 -0
- data/spec/controllers/dorsale/comments_controller_spec.rb +45 -0
- data/spec/controllers/dorsale/customer_vault/corporations_controller_spec.rb +132 -0
- data/spec/controllers/dorsale/customer_vault/individuals_controller_spec.rb +130 -0
- data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +59 -0
- data/spec/controllers/dorsale/flyboy/folders_controller_spec.rb +111 -0
- data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +16 -0
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +234 -0
- data/spec/dummy/app/assets/javascripts/application.coffee +10 -0
- data/spec/dummy/app/assets/stylesheets/application.sass +9 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/models/ability.rb +16 -0
- data/spec/dummy/app/models/dummy_model.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +10 -3
- data/spec/dummy/config/application.rb +4 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150616082916_create_dorsale_dummy_models.rb +8 -0
- data/spec/dummy/db/migrate/20150624081204_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +31 -0
- data/spec/dummy/db/migrate/20150624081205_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/spec/dummy/db/migrate/20150624081206_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/spec/dummy/db/migrate/20150624081207_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
- data/spec/dummy/db/migrate/20150624081208_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +10 -0
- data/spec/dummy/db/schema.rb +243 -5
- data/spec/dummy/db/seed.rb +1 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +227 -0
- data/spec/dummy/log/test.log +2740 -25
- data/spec/dummy/{app/assets/stylesheets/application.css → tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705} +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/factories/alexandrie_attachments.rb +12 -0
- data/spec/factories/billing_machine_id_cards.rb +26 -0
- data/spec/factories/billing_machine_invoice_lines.rb +11 -0
- data/spec/factories/billing_machine_invoices.rb +12 -0
- data/spec/factories/billing_machine_payment_terms.rb +5 -0
- data/spec/factories/billing_machine_quotation_lines.rb +12 -0
- data/spec/factories/billing_machine_quotations.rb +12 -0
- data/spec/factories/customer_vault_corporations.rb +14 -0
- data/spec/factories/customer_vault_individuals.rb +19 -0
- data/spec/factories/customer_vault_links.rb +7 -0
- data/spec/factories/dorsale_addresses.rb +6 -8
- data/spec/factories/dorsale_comments.rb +8 -0
- data/spec/factories/flyboy_folders.rb +7 -0
- data/spec/factories/flyboy_task_comments.rb +8 -0
- data/spec/factories/flyboy_tasks.rb +12 -0
- data/spec/files/pdf.pdf +0 -0
- data/spec/helpers/dorsale/flyboy/application_helper_spec.rb +91 -0
- data/spec/helpers/dorsale/link_helper_spec.rb +1 -0
- data/spec/helpers/dorsale/text_helper_spec.rb +33 -9
- data/spec/models/dorsale/ability_helper_spec.rb +11 -0
- data/spec/models/dorsale/alexandrie/ability_helper_spec.rb +10 -0
- data/spec/models/dorsale/alexandrie/attachment_spec.rb +12 -0
- data/spec/models/dorsale/billing_machine/id_card_spec.rb +12 -0
- data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +50 -0
- data/spec/models/dorsale/billing_machine/invoice_spec.rb +156 -0
- data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +36 -0
- data/spec/models/dorsale/billing_machine/quotation_spec.rb +91 -0
- data/spec/models/dorsale/comment_spec.rb +11 -0
- data/spec/models/dorsale/customer_vault/corporation_spec.rb +17 -0
- data/spec/models/dorsale/customer_vault/individual_spec.rb +17 -0
- data/spec/models/dorsale/customer_vault/link_spec.rb +12 -0
- data/spec/models/dorsale/customer_vault/person_spec.rb +44 -0
- data/spec/models/dorsale/flyboy/ability_spec.rb +148 -0
- data/spec/models/dorsale/flyboy/folder_spec.rb +103 -0
- data/spec/models/dorsale/flyboy/task_comment_spec.rb +52 -0
- data/spec/models/dorsale/flyboy/task_spec.rb +83 -0
- data/spec/pdfs/dorsale/billing_machine/invoice_pdf_spec.rb +252 -0
- data/spec/pdfs/dorsale/billing_machine/quotation_pdf_spec.rb +255 -0
- data/spec/rails_helper.rb +11 -11
- data/spec/routing/dorsale/alexandrie/attachments_routing_spec.rb +19 -0
- data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +53 -0
- data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +43 -0
- data/spec/routing/dorsale/comments_routing_spec.rb +25 -0
- data/spec/routing/dorsale/customer_vault/corporations_routing_spec.rb +66 -0
- data/spec/routing/dorsale/customer_vault/individual_routing_spec.rb +66 -0
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +22 -0
- data/spec/routing/dorsale/flyboy/folders_routing_spec.rb +44 -0
- data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +12 -0
- data/spec/routing/dorsale/flyboy/tasks_routing_spec.rb +44 -0
- data/spec/spec_helper.rb +0 -6
- metadata +439 -10
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -3
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Ability do
|
4
|
+
let(:ability){
|
5
|
+
::Ability.new
|
6
|
+
}
|
7
|
+
|
8
|
+
describe Dorsale::Flyboy::Folder do
|
9
|
+
it "can list folders" do
|
10
|
+
expect(ability.can?(:list, Dorsale::Flyboy::Folder)).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "can create folders" do
|
14
|
+
expect(ability.can?(:create, Dorsale::Flyboy::Folder.new)).to be true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "can read folders" do
|
18
|
+
expect(ability.can?(:read, Dorsale::Flyboy::Folder.new)).to be true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "can update open folders" do
|
22
|
+
folder = create(:flyboy_folder, status: "open")
|
23
|
+
expect(ability.can?(:update, folder)).to be true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "can't update closed folders" do
|
27
|
+
folder = create(:flyboy_folder, status: "closed")
|
28
|
+
expect(ability.can?(:update, folder)).to be false
|
29
|
+
end
|
30
|
+
|
31
|
+
it "can delete open folders" do
|
32
|
+
folder = create(:flyboy_folder, status: "open")
|
33
|
+
expect(ability.can?(:delete, folder)).to be true
|
34
|
+
end
|
35
|
+
|
36
|
+
it "can't delete closed folders" do
|
37
|
+
folder = create(:flyboy_folder, status: "closed")
|
38
|
+
expect(ability.can?(:delete, folder)).to be false
|
39
|
+
end
|
40
|
+
|
41
|
+
it "can close open folder" do
|
42
|
+
folder = create(:flyboy_folder, status: "open")
|
43
|
+
expect(ability.can?(:close, folder)).to be true
|
44
|
+
end
|
45
|
+
|
46
|
+
it "can't close already closed folder" do
|
47
|
+
folder = create(:flyboy_folder, status: "closed")
|
48
|
+
expect(ability.can?(:close, folder)).to be false
|
49
|
+
end
|
50
|
+
|
51
|
+
it "can open closed folder" do
|
52
|
+
folder = create(:flyboy_folder, status: "closed")
|
53
|
+
expect(ability.can?(:open, folder)).to be true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "can't close folders with undone tasks" do
|
57
|
+
task = create(:flyboy_task, done: false)
|
58
|
+
folder = task.taskable
|
59
|
+
expect(ability.can?(:close, folder)).to be false
|
60
|
+
end
|
61
|
+
|
62
|
+
it "can't open already open folder" do
|
63
|
+
folder = create(:flyboy_folder, status: "open")
|
64
|
+
expect(ability.can?(:open, folder)).to be false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe Dorsale::Flyboy::Task do
|
69
|
+
it "can list tasks" do
|
70
|
+
expect(ability.can?(:list, Dorsale::Flyboy::Task)).to be true
|
71
|
+
end
|
72
|
+
|
73
|
+
it "can create task in an open folder" do
|
74
|
+
folder = create(:flyboy_folder, status: "open")
|
75
|
+
task = folder.tasks.new
|
76
|
+
expect(ability.can?(:create, task)).to be true
|
77
|
+
end
|
78
|
+
|
79
|
+
it "can't create task in a closed folder" do
|
80
|
+
folder = create(:flyboy_folder, status: "closed")
|
81
|
+
task = folder.tasks.new
|
82
|
+
expect(ability.can?(:create, task)).to be false
|
83
|
+
end
|
84
|
+
|
85
|
+
it "can read task" do
|
86
|
+
task = create(:flyboy_task)
|
87
|
+
expect(ability.can?(:read, task)).to be true
|
88
|
+
end
|
89
|
+
|
90
|
+
it "can update task in an open folder" do
|
91
|
+
folder = create(:flyboy_folder, status: "open")
|
92
|
+
task = create(:flyboy_task, taskable: folder)
|
93
|
+
expect(ability.can?(:update, task)).to be true
|
94
|
+
end
|
95
|
+
|
96
|
+
it "can't update task in an closed folder" do
|
97
|
+
folder = create(:flyboy_folder, status: "closed")
|
98
|
+
task = create(:flyboy_task, taskable: folder)
|
99
|
+
expect(ability.can?(:update, task)).to be false
|
100
|
+
end
|
101
|
+
|
102
|
+
it "can delete task in an open folder" do
|
103
|
+
folder = create(:flyboy_folder, status: "open")
|
104
|
+
task = create(:flyboy_task, taskable: folder)
|
105
|
+
expect(ability.can?(:delete, task)).to be true
|
106
|
+
end
|
107
|
+
|
108
|
+
it "can't delete task in an closed folder" do
|
109
|
+
folder = create(:flyboy_folder, status: "closed")
|
110
|
+
task = create(:flyboy_task, taskable: folder)
|
111
|
+
expect(ability.can?(:delete, task)).to be false
|
112
|
+
end
|
113
|
+
|
114
|
+
it "can complete a undone task" do
|
115
|
+
task = create(:flyboy_task, done: false)
|
116
|
+
expect(ability.can?(:complete, task)).to be true
|
117
|
+
end
|
118
|
+
|
119
|
+
it "can't complete a done task" do
|
120
|
+
task = create(:flyboy_task, done: true)
|
121
|
+
expect(ability.can?(:complete, task)).to be false
|
122
|
+
end
|
123
|
+
|
124
|
+
it "can snooze a done task" do
|
125
|
+
task = create(:flyboy_task, done: false)
|
126
|
+
expect(ability.can?(:snooze, task)).to be true
|
127
|
+
end
|
128
|
+
|
129
|
+
it "can't snooze a done task" do
|
130
|
+
task = create(:flyboy_task, done: true)
|
131
|
+
expect(ability.can?(:snooze, task)).to be false
|
132
|
+
end
|
133
|
+
|
134
|
+
it "can't snooze if reminder >= today" do
|
135
|
+
task = create(:flyboy_task, reminder: Date.today, term: Date.tomorrow)
|
136
|
+
expect(ability.can?(:snooze, task)).to be false
|
137
|
+
end
|
138
|
+
|
139
|
+
it "can't create a task if it can't read taskable" do
|
140
|
+
class DummyObject; end
|
141
|
+
task = build(:flyboy_task)
|
142
|
+
def task.taskable; DummyObject.new; end
|
143
|
+
|
144
|
+
expect(ability.can?(:create, task)).to be false
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dorsale::Flyboy::Folder do
|
4
|
+
it { is_expected.to have_many(:tasks).dependent(:destroy) }
|
5
|
+
it { is_expected.to belong_to(:folderable) }
|
6
|
+
|
7
|
+
it { should validate_presence_of :name }
|
8
|
+
|
9
|
+
it "should validate the folder when not step is assigned" do
|
10
|
+
folder = build(:flyboy_folder)
|
11
|
+
expect(folder).to be_valid
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should ensure that status has a valid value" do
|
15
|
+
folder = build(:flyboy_folder, status: 999)
|
16
|
+
expect(folder).to_not be_valid
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should increase the version number" do
|
20
|
+
folder = create(:flyboy_folder)
|
21
|
+
expect(folder.version).to eq 1
|
22
|
+
folder.save
|
23
|
+
expect(folder.version).to eq 2
|
24
|
+
folder.save
|
25
|
+
expect(folder.version).to eq 3
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should create tracking" do
|
29
|
+
Timecop.freeze DateTime.new(2013, 8, 1, 9, 13, 5)
|
30
|
+
|
31
|
+
folder1 = create(:flyboy_folder)
|
32
|
+
folder2 = create(:flyboy_folder)
|
33
|
+
folder3 = create(:flyboy_folder)
|
34
|
+
|
35
|
+
expect(folder1.tracking).to eq "130801-1"
|
36
|
+
expect(folder2.tracking).to eq "130801-2"
|
37
|
+
expect(folder3.tracking).to eq "130801-3"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "revision should contain tracking and version" do
|
41
|
+
Timecop.freeze Time.parse("2012-12-21 12:00:00")
|
42
|
+
folder = create(:flyboy_folder)
|
43
|
+
expect(folder.revision).to eq "121221-1 1"
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#progress" do
|
47
|
+
it "update task should update folder progress" do
|
48
|
+
folder = create(:flyboy_folder)
|
49
|
+
task1 = create(:flyboy_task, taskable: folder, progress: 50)
|
50
|
+
task2 = create(:flyboy_task, taskable: folder, progress: 100)
|
51
|
+
expect(folder.reload.progress).to eq 75
|
52
|
+
task1.progress = 100
|
53
|
+
task1.save
|
54
|
+
expect(folder.reload.progress).to eq 100
|
55
|
+
end
|
56
|
+
|
57
|
+
it "delete task should update folder progress" do
|
58
|
+
folder = create(:flyboy_folder)
|
59
|
+
task1 = create(:flyboy_task, taskable: folder, progress: 50)
|
60
|
+
expect(folder.reload.progress).to eq 50
|
61
|
+
task1.destroy
|
62
|
+
expect(folder.reload.progress).to eq 0
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should be 0 if new folder" do
|
66
|
+
expect(Dorsale::Flyboy::Folder.new.progress).to eq 0
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "states" do
|
71
|
+
it "initial state should be open" do
|
72
|
+
expect(Dorsale::Flyboy::Folder.new.status).to eq "open"
|
73
|
+
end
|
74
|
+
|
75
|
+
it "open folder can be closed" do
|
76
|
+
folder = create(:flyboy_folder, status: "open")
|
77
|
+
expect(folder.close).to be true
|
78
|
+
expect(folder.status).to eq "closed"
|
79
|
+
end
|
80
|
+
|
81
|
+
it "closed folder can be reopened" do
|
82
|
+
folder = create(:flyboy_folder, status: "closed")
|
83
|
+
expect(folder.open).to be true
|
84
|
+
expect(folder.status).to eq "open"
|
85
|
+
end
|
86
|
+
|
87
|
+
it "open folder with undone tasks can't be closed" do
|
88
|
+
folder = create(:flyboy_folder, status: "open")
|
89
|
+
task = create(:flyboy_task, taskable: folder, done: false)
|
90
|
+
expect(folder.close).to be false
|
91
|
+
expect(folder.status).to eq "open"
|
92
|
+
end
|
93
|
+
|
94
|
+
it "open folder with all tasks done can be closed" do
|
95
|
+
folder = create(:flyboy_folder, status: "open")
|
96
|
+
task = create(:flyboy_task, taskable: folder, done: true)
|
97
|
+
expect(folder.close).to be true
|
98
|
+
expect(folder.status).to eq "closed"
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dorsale::Flyboy::TaskComment do
|
4
|
+
it { is_expected.to belong_to(:task) }
|
5
|
+
|
6
|
+
it { is_expected.to validate_presence_of :task }
|
7
|
+
it { is_expected.to validate_presence_of :date }
|
8
|
+
it { is_expected.to validate_presence_of :description }
|
9
|
+
|
10
|
+
it 'should have a valid factory' do
|
11
|
+
expect(build(:flyboy_task_comment)).to be_valid
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should update the task progress upon creation' do
|
15
|
+
task = create(:flyboy_task, progress: 10)
|
16
|
+
comment = create(:flyboy_task_comment, progress: 20, task: task)
|
17
|
+
expect(task.reload.progress).to eq(20)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should mark task as complete when progress == 100' do
|
21
|
+
task = create(:flyboy_task, progress: 10, done: false)
|
22
|
+
comment = create(:flyboy_task_comment, progress: 100, task: task)
|
23
|
+
expect(task.reload.done).to be true
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should mark task as un complete when progress < 100' do
|
27
|
+
task = create(:flyboy_task, progress: 100, done: true)
|
28
|
+
comment = create(:flyboy_task_comment, progress: 90, task: task)
|
29
|
+
expect(task.reload.done).to be false
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "default values" do
|
33
|
+
it "#new progress should be 0 if no task" do
|
34
|
+
expect(Dorsale::Flyboy::TaskComment.new.progress).to eq 0
|
35
|
+
end
|
36
|
+
|
37
|
+
it "#new progress should be task progress if task specified" do
|
38
|
+
task = create(:flyboy_task, progress: 50)
|
39
|
+
expect(task.comments.new.progress).to eq 50
|
40
|
+
end
|
41
|
+
|
42
|
+
it "#new progress should not override exisring progress" do
|
43
|
+
task = create(:flyboy_task)
|
44
|
+
comment1 = create(:flyboy_task_comment, task: task, progress: 30)
|
45
|
+
comment2 = create(:flyboy_task_comment, task: task, progress: 50)
|
46
|
+
expect(task.reload.progress).to eq 50
|
47
|
+
expect(comment1.reload.progress).to eq 30
|
48
|
+
expect(comment2.reload.progress).to eq 50
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dorsale::Flyboy::Task do
|
4
|
+
it { is_expected.to belong_to(:taskable) }
|
5
|
+
it { is_expected.to have_many(:comments).dependent(:destroy) }
|
6
|
+
|
7
|
+
it { is_expected.to validate_presence_of :taskable}
|
8
|
+
it { is_expected.to validate_presence_of :name}
|
9
|
+
it { is_expected.to validate_presence_of :term}
|
10
|
+
it { is_expected.to validate_presence_of :reminder}
|
11
|
+
|
12
|
+
describe "default values" do
|
13
|
+
before do
|
14
|
+
@task = Dorsale::Flyboy::Task.new
|
15
|
+
end
|
16
|
+
|
17
|
+
it "#done should be false" do
|
18
|
+
expect(@task.done).to be false
|
19
|
+
end
|
20
|
+
|
21
|
+
it "#reminter should be present" do
|
22
|
+
expect(@task.reminder.present?).to be true
|
23
|
+
end
|
24
|
+
|
25
|
+
it "#term should be present" do
|
26
|
+
expect(@task.term.present?).to be true
|
27
|
+
end
|
28
|
+
|
29
|
+
it "#progress should be 0" do
|
30
|
+
expect(@task.progress).to eq 0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#validation' do
|
35
|
+
it 'factory should be #valid?' do
|
36
|
+
expect(create(:flyboy_task)).to be_valid
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should ensure that term >= reminder' do
|
40
|
+
date = Date.today
|
41
|
+
task = build(:flyboy_task, reminder: date+1.day, term: date)
|
42
|
+
expect(task).to_not be_valid
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#snooze' do
|
47
|
+
before do
|
48
|
+
@today = Date.today
|
49
|
+
@task = build(:flyboy_task, reminder: @today - 5 , term: @today + 5)
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'term not passed' do
|
53
|
+
it "should snooze the reminder and term with default value" do
|
54
|
+
@task.snooze
|
55
|
+
expect(@task.reminder).to eq Date.today + 2
|
56
|
+
expect(@task.term).to eq Date.today + 35
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'reminder too far is the past' do
|
60
|
+
it "should set reminder to today" do
|
61
|
+
@task.reminder = @today - 30
|
62
|
+
@task.term = @today + 1
|
63
|
+
@task.snooze
|
64
|
+
expect(@task.reminder).to eq Date.today + 1
|
65
|
+
expect(@task.term).to eq Date.today + 1
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'term passed' do
|
71
|
+
before do
|
72
|
+
@task.term = Date.today - 2
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should snooze the reminder and term with default value from current date" do
|
76
|
+
@task.snooze
|
77
|
+
expect(@task.reminder).to eq @today + 7
|
78
|
+
expect(@task.term).to eq @today + 30
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end # describe '#snooze'
|
83
|
+
end
|
@@ -0,0 +1,252 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
describe ::Dorsale::BillingMachine::InvoicePdf, pdfs: true do
|
4
|
+
|
5
|
+
def self.it_should_write(string)
|
6
|
+
it "should write '#{string}'" do
|
7
|
+
text.strings.should include string
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:customer) {
|
12
|
+
create(:customer_vault_corporation)
|
13
|
+
}
|
14
|
+
|
15
|
+
let(:id_card) { create(:billing_machine_id_card,
|
16
|
+
entity_name: "HEYHO",
|
17
|
+
registration_city: 'RCS MARSEILLE',
|
18
|
+
registration_number: '000 000 000',
|
19
|
+
siret: '000 000 000 00000',
|
20
|
+
ape_naf: '0000A',
|
21
|
+
legal_form: 'SARL',
|
22
|
+
capital: 1_000_000_000,
|
23
|
+
intracommunity_vat: 'FR 00 000 000 000 000 00',
|
24
|
+
address1: '42 Avenue de Ruby', zip: '13004',
|
25
|
+
city: 'Marseille',
|
26
|
+
contact_full_name: 'Jane Doe',
|
27
|
+
contact_phone: '+33.6.00.00.00.00',
|
28
|
+
contact_fax: '+33.9.00.00.00.00',
|
29
|
+
contact_email: 'email@example.org',
|
30
|
+
iban: 'FR76 0000 0000 0000 0000 0000 000',
|
31
|
+
bic_swift: 'PSSTTHEGAME',
|
32
|
+
custom_info_1: "Mention légale" + "\n" + "Tout retard de règlement donnera lieu de plein droit et sans qu’aucune mise en demeure ne soit nécessaire au paiement de " +
|
33
|
+
'pénalités de retard sur la base du taux BCE majoré de dix (10) points et au paiement d’une indemnité forfaitaire pour frais de ' +
|
34
|
+
'recouvrement d’un montant de 999999€'
|
35
|
+
) }
|
36
|
+
|
37
|
+
let(:invoice) { create(:billing_machine_invoice,
|
38
|
+
date: '16/04/2014',
|
39
|
+
id_card: id_card,
|
40
|
+
customer: customer,
|
41
|
+
total_duty: 1812.53,
|
42
|
+
vat_amount: 355.26,
|
43
|
+
total_all_taxes: 2167.79,
|
44
|
+
advance: 1.79,
|
45
|
+
vat_rate: 19.6,
|
46
|
+
balance: 2166.0) }
|
47
|
+
|
48
|
+
let(:invoice_line) { create(:billing_machine_invoice_line,
|
49
|
+
invoice_id: invoice.id,
|
50
|
+
quantity: 3.14,
|
51
|
+
unit: 'heures',
|
52
|
+
unit_price: 2.54,
|
53
|
+
total: 7.98) }
|
54
|
+
|
55
|
+
let(:invoice_line_2) { create(:billing_machine_invoice_line,
|
56
|
+
invoice_id: invoice.id,
|
57
|
+
label: 'Truc',
|
58
|
+
quantity: 42.42,
|
59
|
+
unit: 'nuts',
|
60
|
+
unit_price: 42.54,
|
61
|
+
total: 1804.55) }
|
62
|
+
|
63
|
+
let(:pdf) {
|
64
|
+
invoice.pdf
|
65
|
+
}
|
66
|
+
|
67
|
+
describe "#initialize" do
|
68
|
+
it 'inherits from Prawn::Document' do
|
69
|
+
pdf.should be_kind_of(Prawn::Document)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should assign @main_document' do
|
73
|
+
pdf.main_document.should eq(invoice)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "#build" do
|
78
|
+
let(:text) { PDF::Inspector::Text.analyze(pdf.render) }
|
79
|
+
|
80
|
+
context 'when the id card is empty' do
|
81
|
+
let(:id_card) {
|
82
|
+
::Dorsale::BillingMachine::IdCard.create(id_card_name: 'default')
|
83
|
+
}
|
84
|
+
it 'should not crash' do
|
85
|
+
pdf.build
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
before do
|
90
|
+
invoice.lines << invoice_line
|
91
|
+
invoice.lines << invoice_line_2
|
92
|
+
pdf.build
|
93
|
+
end
|
94
|
+
context 'in Mentions légales - Coin supérieur droit' do
|
95
|
+
it_should_write 'HEYHO'
|
96
|
+
it_should_write 'SIRET 000 000 000 00000 APE 0000A'
|
97
|
+
it_should_write 'SARL au capital de 1.000.000.000 euros'
|
98
|
+
it_should_write 'RCS MARSEILLE 000 000 000'
|
99
|
+
it_should_write 'N° TVA FR 00 000 000 000 000 00'
|
100
|
+
it_should_write '42 Avenue de Ruby'
|
101
|
+
it_should_write '13004 Marseille'
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'in Entete de facturation' do
|
105
|
+
|
106
|
+
it_should_write 'Facture'
|
107
|
+
|
108
|
+
it "should write invoice tracking id" do
|
109
|
+
text.strings.should include ' N°' + invoice.tracking_id
|
110
|
+
end
|
111
|
+
it "should write 'Marseille le ' and invoice date" do
|
112
|
+
text.strings.should include 'Marseille le ' + '16 avril 2014'
|
113
|
+
end
|
114
|
+
|
115
|
+
context 'in Informations contact' do
|
116
|
+
it_should_write 'Contact :'
|
117
|
+
it_should_write ' Jane Doe'
|
118
|
+
it_should_write 'Tél :'
|
119
|
+
it_should_write ' +33.6.00.00.00.00'
|
120
|
+
it_should_write 'Fax:'
|
121
|
+
it_should_write ' +33.9.00.00.00.00'
|
122
|
+
it_should_write 'Email:'
|
123
|
+
it_should_write ' email@example.org'
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'in Informations client' do
|
127
|
+
it_should_write 'A l’attention de :'
|
128
|
+
|
129
|
+
it "should write customer name" do
|
130
|
+
text.strings.should include invoice.customer.name
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should write customer address" do
|
134
|
+
text.strings.should include invoice.customer.address.street
|
135
|
+
text.strings.should include invoice.customer.address.street_bis
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should write customer zip and city" do
|
139
|
+
text.strings.should include invoice.customer.address.zip.to_s +
|
140
|
+
' ' + invoice.customer.address.city.to_s
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should write customer country" do
|
144
|
+
text.strings.should include invoice.customer.address.country
|
145
|
+
end
|
146
|
+
end # context in Informations client
|
147
|
+
end # context in Entete de facturation
|
148
|
+
|
149
|
+
it "shoud write 'Objet :' and invoice label" do
|
150
|
+
text.strings.should include 'Objet :'
|
151
|
+
text.strings.should include ' ' + invoice.label
|
152
|
+
end
|
153
|
+
|
154
|
+
context "in Tableau" do
|
155
|
+
it_should_write 'Prestation'
|
156
|
+
it_should_write 'Prix'
|
157
|
+
it_should_write 'unitaire'
|
158
|
+
it_should_write 'Quantité'
|
159
|
+
it_should_write 'Total HT'
|
160
|
+
|
161
|
+
|
162
|
+
context "in Lignes de facturation" do
|
163
|
+
it 'should write invoice line label of each invoice line' do
|
164
|
+
invoice.lines.each do |line|
|
165
|
+
text.strings.should include line.label
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'should write invoice line quantity of each line' do
|
170
|
+
text.strings.should include '3,14'
|
171
|
+
text.strings.should include '42,42'
|
172
|
+
end
|
173
|
+
|
174
|
+
it 'should write invoice line unit_price of each line' do
|
175
|
+
text.strings.should include '2,54 €'
|
176
|
+
text.strings.should include '42,54 €'
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'should write invoice line total of each line' do
|
180
|
+
text.strings.should include '7,98 €'
|
181
|
+
text.strings.should include '1.804,55 €'
|
182
|
+
end
|
183
|
+
end # context in Lignes de facturation
|
184
|
+
|
185
|
+
context 'in Synthèse' do
|
186
|
+
it_should_write 'Total HT'
|
187
|
+
it_should_write '1.812,52 €'
|
188
|
+
|
189
|
+
it_should_write 'TVA 19,6 %'
|
190
|
+
it_should_write '355,25 €'
|
191
|
+
|
192
|
+
it_should_write 'Total TTC'
|
193
|
+
it_should_write '2.167,78 €'
|
194
|
+
|
195
|
+
it_should_write 'Acompte reçu sur commande'
|
196
|
+
it_should_write '1,79 €'
|
197
|
+
|
198
|
+
it_should_write 'Solde à payer'
|
199
|
+
it 'should write balance calculated using total_all_taxes - advance' do
|
200
|
+
text.strings.should include '2.165,99 €'
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
context 'without advance' do
|
205
|
+
|
206
|
+
before(:each) do
|
207
|
+
invoice_incomplete=create(:billing_machine_invoice, total_duty: 1000, vat_amount: 196,
|
208
|
+
total_all_taxes: 1196, advance: 0, balance: 1146 , customer: customer,
|
209
|
+
date: '2014-04-16', vat_rate: 19.6, id_card: id_card)
|
210
|
+
pdf_incomplete = invoice_incomplete.pdf
|
211
|
+
pdf_incomplete.build
|
212
|
+
@text_incomplete = PDF::Inspector::Text.analyze(pdf_incomplete.render)
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'should not write Acompte reçu sur commande' do
|
216
|
+
@text_incomplete.strings.should_not include 'Acompte reçu sur commande'
|
217
|
+
end
|
218
|
+
|
219
|
+
it 'should not write Solde à payer' do
|
220
|
+
@text_incomplete.strings.should_not include 'Solde à payer'
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end # context in Tableau
|
226
|
+
it_should_write 'Conditions de paiement :'
|
227
|
+
|
228
|
+
it 'should write invoice payment term' do
|
229
|
+
text.strings.should include invoice.payment_term.label
|
230
|
+
end
|
231
|
+
|
232
|
+
it_should_write 'Coordonnées bancaires :'
|
233
|
+
it_should_write 'IBAN : FR76 0000 0000 0000 0000 0000 000'
|
234
|
+
it_should_write 'BIC / SWIFT : PSSTTHEGAME'
|
235
|
+
|
236
|
+
context 'in Mentions légales - Bas de page' do
|
237
|
+
it_should_write 'Mention légale'
|
238
|
+
it_should_write 'Tout retard de règlement donnera lieu de plein droit et sans qu’aucune mise en demeure ne soit nécessaire au paiement de'
|
239
|
+
it_should_write 'pénalités de retard sur la base du taux BCE majoré de dix (10) points et au paiement d’une indemnité forfaitaire pour frais de'
|
240
|
+
it_should_write 'recouvrement d’un montant de 999999€'
|
241
|
+
end
|
242
|
+
end # describe #build
|
243
|
+
|
244
|
+
describe "missing data" do
|
245
|
+
it "missing payment_term should be OK" do
|
246
|
+
invoice = create(:billing_machine_invoice, payment_term: nil)
|
247
|
+
pdf = invoice.pdf
|
248
|
+
pdf.build
|
249
|
+
PDF::Inspector::Text.analyze(pdf.render)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|