canmoia 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/Guardfile +30 -0
  3. data/README.md +186 -0
  4. data/Rakefile +27 -0
  5. data/WTFP-LICENSE +13 -0
  6. data/lib/canmoia/concerns/notification.rb~ +38 -0
  7. data/lib/canmoia/concerns/order.rb +71 -0
  8. data/lib/canmoia/concerns/order.rb~ +65 -0
  9. data/lib/canmoia/concerns/work.rb +21 -0
  10. data/lib/canmoia/concerns/work.rb~ +33 -0
  11. data/lib/canmoia/features/notification.rb +51 -0
  12. data/lib/canmoia/features/notification.rb~ +38 -0
  13. data/lib/canmoia/tasks/install.rb.erb +23 -0
  14. data/lib/canmoia/version.rb +3 -0
  15. data/lib/canmoia.rb +8 -0
  16. data/lib/canmoia.rb~ +6 -0
  17. data/lib/tasks/canmoia_tasks.rake +4 -0
  18. data/lib/tasks/canmoia_tasks.rb.erb +16 -0
  19. data/spec/concerns/order_spec.rb +45 -0
  20. data/spec/concerns/order_spec.rb~ +41 -0
  21. data/spec/concerns/work_spec.rb +32 -0
  22. data/spec/dummy/README.rdoc +261 -0
  23. data/spec/dummy/Rakefile +7 -0
  24. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  27. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  28. data/spec/dummy/app/mailers/notifiable_order_mailer.rb~ +14 -0
  29. data/spec/dummy/app/mailers/work_order_mailer.rb +14 -0
  30. data/spec/dummy/app/mailers/work_order_mailer.rb~ +14 -0
  31. data/spec/dummy/app/models/employee.rb +4 -0
  32. data/spec/dummy/app/models/employee.rb~ +3 -0
  33. data/spec/dummy/app/models/item.rb +5 -0
  34. data/spec/dummy/app/models/order.rb +4 -0
  35. data/spec/dummy/app/models/order.rb~ +4 -0
  36. data/spec/dummy/app/models/user.rb +6 -0
  37. data/spec/dummy/app/models/user.rb~ +4 -0
  38. data/spec/dummy/app/models/work_order.rb +4 -0
  39. data/spec/dummy/app/models/work_order.rb~ +3 -0
  40. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  41. data/spec/dummy/app/views/work_order_mailer/close_notification_to_responsible.text.erb +3 -0
  42. data/spec/dummy/config/application.rb +62 -0
  43. data/spec/dummy/config/application.rb~ +59 -0
  44. data/spec/dummy/config/boot.rb +10 -0
  45. data/spec/dummy/config/database.yml +25 -0
  46. data/spec/dummy/config/environment.rb +5 -0
  47. data/spec/dummy/config/environment.rb~ +5 -0
  48. data/spec/dummy/config/environments/development.rb +37 -0
  49. data/spec/dummy/config/environments/development.rb~ +37 -0
  50. data/spec/dummy/config/environments/production.rb +67 -0
  51. data/spec/dummy/config/environments/test.rb +37 -0
  52. data/spec/dummy/config/environments/test.rb~ +37 -0
  53. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  54. data/spec/dummy/config/initializers/inflections.rb +15 -0
  55. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  56. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  57. data/spec/dummy/config/initializers/session_store.rb +8 -0
  58. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  59. data/spec/dummy/config/locales/en.yml +5 -0
  60. data/spec/dummy/config/mongoid.yml +68 -0
  61. data/spec/dummy/config/mongoid.yml~ +68 -0
  62. data/spec/dummy/config/routes.rb +58 -0
  63. data/spec/dummy/config.ru +4 -0
  64. data/spec/dummy/db/development.sqlite3 +0 -0
  65. data/spec/dummy/log/development.log +1 -0
  66. data/spec/dummy/log/test.log +4574 -0
  67. data/spec/dummy/public/404.html +26 -0
  68. data/spec/dummy/public/422.html +26 -0
  69. data/spec/dummy/public/500.html +25 -0
  70. data/spec/dummy/public/favicon.ico +0 -0
  71. data/spec/dummy/script/rails +6 -0
  72. data/spec/dummy/spec/fixtures/work_order_mailer/close_notification_to_responsible +3 -0
  73. data/spec/dummy/spec/mailers/notifiable_order_mailer_spec.rb~ +18 -0
  74. data/spec/dummy/spec/mailers/work_order_mailer_spec.rb +19 -0
  75. data/spec/dummy/spec/mailers/work_order_mailer_spec.rb~ +20 -0
  76. data/spec/fabricators/item_fabricator.rb +5 -0
  77. data/spec/fabricators/item_fabricator.rb~ +5 -0
  78. data/spec/fabricators/order_fabricator.rb +15 -0
  79. data/spec/fabricators/order_fabricator.rb~ +9 -0
  80. data/spec/fabricators/user_fabricator.rb +7 -0
  81. data/spec/fabricators/user_fabricator.rb~ +7 -0
  82. data/spec/spec_helper.rb +50 -0
  83. data/spec/spec_helper.rb~ +34 -0
  84. data/spec/support/concern_macros.rb +0 -0
  85. data/spec/support/fabrication.rb +8 -0
  86. data/spec/support/fabricator.rb +5 -0
  87. data/spec/support/mailer_macros.rb +9 -0
  88. metadata +437 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,3 @@
1
+ WorkOrderMailer#close_notification_to_responsible
2
+
3
+ Hi, find me in app/views/work_order_mailer/close_notification_to_responsible
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe NotifiableOrderMailer do
4
+ describe "close_notification_to_responsible" do
5
+ let(:mail) { NotifiableOrderMailer.close_notification_to_responsible }
6
+
7
+ it "renders the headers" do
8
+ mail.subject.should eq("Close notification to responsible")
9
+ mail.to.should eq(["to@example.org"])
10
+ mail.from.should eq(["from@example.com"])
11
+ end
12
+
13
+ it "renders the body" do
14
+ mail.body.encoded.should match("Hi")
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,19 @@
1
+ require "spec_helper"
2
+
3
+ describe WorkOrderMailer do
4
+ describe "close_notification_to_responsible" do
5
+ let(:mail) {
6
+ order = Fabricate :work_order
7
+ WorkOrderMailer.close_notification_to_responsible order, order.responsible
8
+ }
9
+
10
+ it "renders the headers" do
11
+ mail.subject.should eq("Close notification to responsible")
12
+ end
13
+
14
+ it "renders the body" do
15
+ mail.body.encoded.should match("Hi")
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe WorkOrderMailer do
4
+ describe "close_notification_to_responsible" do
5
+
6
+
7
+ let(:mail) { WorkOrderMailer.close_notification_to_responsible }
8
+
9
+ it "renders the headers" do
10
+ mail.subject.should eq("Close notification to responsible")
11
+ mail.to.should eq(["to@example.org"])
12
+ mail.from.should eq(["from@example.com"])
13
+ end
14
+
15
+ it "renders the body" do
16
+ mail.body.encoded.should match("Hi")
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,5 @@
1
+ Fabricator(:item) do
2
+ value { Forgery::Monetary.money max: 10000 }
3
+ quantity { Forgery::Basic.number at_most: 1000 }
4
+ # TODO for more realistic testing on the future product
5
+ end
@@ -0,0 +1,5 @@
1
+ Fabricator(:item) do
2
+ value Forgery::Monetary.money max: 10000
3
+ quantity Forgery::Basic.number at_most: 1000
4
+ # TODO for more realistic testing on the future product
5
+ end
@@ -0,0 +1,15 @@
1
+ Fabricator(:order) do
2
+ state :opened
3
+ items(count: Forgery::Basic.number(at_most: 1000))
4
+ end
5
+
6
+ Fabricator(:accepted_order, from: :order) do
7
+ state :accepted
8
+ end
9
+
10
+ Fabricator(:work_order) do
11
+ after_build do | order, transients |
12
+ order.responsible = Fabricate(:responsible) if order.respond_to? :responsible
13
+ end
14
+ # responsible
15
+ end
@@ -0,0 +1,9 @@
1
+ Fabricator(:order) do
2
+ state :opened
3
+ responsible
4
+ end
5
+
6
+ Fabricator(:accepted_order, from: :order) do
7
+ state :accepted
8
+ items(count: Forgery::Nu)
9
+ end
@@ -0,0 +1,7 @@
1
+ Fabricator(:user) do
2
+ name { Forgery(:name).full_name }
3
+ email { Forgery(:internet).email_address }
4
+ end
5
+
6
+ Fabricator(:responsible, from: :user) do
7
+ end
@@ -0,0 +1,7 @@
1
+ Fabricator(:user) do
2
+ name { Forgery(:name).full_name }
3
+ end
4
+
5
+
6
+ Fabricator(:responsible, from: :user) do
7
+ end
@@ -0,0 +1,50 @@
1
+ # Configure Rails Envinronment
2
+ ENV["RAILS_ENV"] ||= "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+
6
+ require 'rspec/rails'
7
+ require 'rspec/autorun'
8
+ require 'rails/mongoid'
9
+
10
+ require 'email_spec'
11
+ require 'fabrication'
12
+ require 'forgery'
13
+ require 'database_cleaner'
14
+
15
+ Rails.backtrace_cleaner.remove_silencers!
16
+
17
+ ENGINE_ROOT_DIR = File.dirname(File.expand_path File.join(__FILE__, '..'))
18
+
19
+ # Requires supporting ruby files with custom matchers and macros, etc,
20
+ # in spec/support/ and its subdirectories.
21
+ Dir["#{ENGINE_ROOT_DIR}/spec/support/**/*.rb"].each { |f| require f }
22
+
23
+ RSpec.configure do |config|
24
+ config.treat_symbols_as_metadata_keys_with_true_values = true
25
+ config.run_all_when_everything_filtered = true
26
+ config.filter_run :focus
27
+
28
+ # Email support
29
+ RSpec.configure do |config|
30
+ config.include EmailSpec::Helpers
31
+ config.include EmailSpec::Matchers
32
+ config.include MailerMacros
33
+ end
34
+
35
+ # Fabrication support
36
+
37
+
38
+
39
+ # Database Cleaner support
40
+ config.before(:each) do
41
+ DatabaseCleaner.strategy = :truncation, {:except => %w[ ]}
42
+ DatabaseCleaner.clean
43
+ end
44
+
45
+ # Run specs in random order to surface order dependencies. If you find an
46
+ # order dependency and want to debug it, you can fix the order by providing
47
+ # the seed, which is printed after each run.
48
+ # --seed 1234
49
+ config.order = 'random'
50
+ end
@@ -0,0 +1,34 @@
1
+ # Configure Rails Envinronment
2
+ ENV["RAILS_ENV"] ||= "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+
6
+ require 'rspec/rails'
7
+ require 'rspec/autorun'
8
+ require 'rails/mongoid'
9
+ require 'forgery'
10
+ require 'database_cleaner'
11
+
12
+ Rails.backtrace_cleaner.remove_silencers!
13
+
14
+ # Requires supporting ruby files with custom matchers and macros, etc,
15
+ # in spec/support/ and its subdirectories.
16
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
17
+
18
+ RSpec.configure do |config|
19
+ config.treat_symbols_as_metadata_keys_with_true_values = true
20
+ config.run_all_when_everything_filtered = true
21
+ config.filter_run :focus
22
+
23
+ # Database Cleaner support
24
+ config.before(:each) do
25
+ DatabaseCleaner.strategy = :truncation, {:except => %w[ ]}
26
+ DatabaseCleaner.clean
27
+ end
28
+
29
+ # Run specs in random order to surface order dependencies. If you find an
30
+ # order dependency and want to debug it, you can fix the order by providing
31
+ # the seed, which is printed after each run.
32
+ # --seed 1234
33
+ config.order = 'random'
34
+ end
File without changes
@@ -0,0 +1,8 @@
1
+ Fabrication.configure do |config|
2
+ config.fabricator_path = 'spec/fabricators'
3
+ config.path_prefix = ENGINE_ROOT_DIR
4
+ config.sequence_start = 10000
5
+ end
6
+
7
+ # TODO Figure out why its not loading automagically
8
+ Fabrication::Support.find_definitions
@@ -0,0 +1,5 @@
1
+ Fabrication.configure do |config|
2
+ config.fabricator_path = 'spec/fabricators'
3
+ config.path_prefix = Rails.root
4
+ config.sequence_start = 10000
5
+ end
@@ -0,0 +1,9 @@
1
+ module MailerMacros
2
+ def last_email
3
+ ActionMailer::Base.deliveries.last
4
+ end
5
+
6
+ def clear_emails
7
+ ActionMailer::Base.deliveries = []
8
+ end
9
+ end