canmoia 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Guardfile +30 -0
- data/README.md +186 -0
- data/Rakefile +27 -0
- data/WTFP-LICENSE +13 -0
- data/lib/canmoia/concerns/notification.rb~ +38 -0
- data/lib/canmoia/concerns/order.rb +71 -0
- data/lib/canmoia/concerns/order.rb~ +65 -0
- data/lib/canmoia/concerns/work.rb +21 -0
- data/lib/canmoia/concerns/work.rb~ +33 -0
- data/lib/canmoia/features/notification.rb +51 -0
- data/lib/canmoia/features/notification.rb~ +38 -0
- data/lib/canmoia/tasks/install.rb.erb +23 -0
- data/lib/canmoia/version.rb +3 -0
- data/lib/canmoia.rb +8 -0
- data/lib/canmoia.rb~ +6 -0
- data/lib/tasks/canmoia_tasks.rake +4 -0
- data/lib/tasks/canmoia_tasks.rb.erb +16 -0
- data/spec/concerns/order_spec.rb +45 -0
- data/spec/concerns/order_spec.rb~ +41 -0
- data/spec/concerns/work_spec.rb +32 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/notifiable_order_mailer.rb~ +14 -0
- data/spec/dummy/app/mailers/work_order_mailer.rb +14 -0
- data/spec/dummy/app/mailers/work_order_mailer.rb~ +14 -0
- data/spec/dummy/app/models/employee.rb +4 -0
- data/spec/dummy/app/models/employee.rb~ +3 -0
- data/spec/dummy/app/models/item.rb +5 -0
- data/spec/dummy/app/models/order.rb +4 -0
- data/spec/dummy/app/models/order.rb~ +4 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/models/user.rb~ +4 -0
- data/spec/dummy/app/models/work_order.rb +4 -0
- data/spec/dummy/app/models/work_order.rb~ +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/work_order_mailer/close_notification_to_responsible.text.erb +3 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/application.rb~ +59 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environment.rb~ +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/development.rb~ +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/environments/test.rb~ +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/mongoid.yml +68 -0
- data/spec/dummy/config/mongoid.yml~ +68 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1 -0
- data/spec/dummy/log/test.log +4574 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/fixtures/work_order_mailer/close_notification_to_responsible +3 -0
- data/spec/dummy/spec/mailers/notifiable_order_mailer_spec.rb~ +18 -0
- data/spec/dummy/spec/mailers/work_order_mailer_spec.rb +19 -0
- data/spec/dummy/spec/mailers/work_order_mailer_spec.rb~ +20 -0
- data/spec/fabricators/item_fabricator.rb +5 -0
- data/spec/fabricators/item_fabricator.rb~ +5 -0
- data/spec/fabricators/order_fabricator.rb +15 -0
- data/spec/fabricators/order_fabricator.rb~ +9 -0
- data/spec/fabricators/user_fabricator.rb +7 -0
- data/spec/fabricators/user_fabricator.rb~ +7 -0
- data/spec/spec_helper.rb +50 -0
- data/spec/spec_helper.rb~ +34 -0
- data/spec/support/concern_macros.rb +0 -0
- data/spec/support/fabrication.rb +8 -0
- data/spec/support/fabricator.rb +5 -0
- data/spec/support/mailer_macros.rb +9 -0
- 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,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,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
|
data/spec/spec_helper.rb
ADDED
@@ -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
|