erp_agreements 3.0.0

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 (68) hide show
  1. data/GPL-3-LICENSE +674 -0
  2. data/README.rdoc +2 -0
  3. data/Rakefile +31 -0
  4. data/app/assets/javascripts/erp_agreements/application.js +9 -0
  5. data/app/assets/stylesheets/erp_agreements/application.css +7 -0
  6. data/app/controllers/erp_agreements/application_controller.rb +4 -0
  7. data/app/helpers/erp_agreements/application_helper.rb +4 -0
  8. data/app/models/agreement.rb +42 -0
  9. data/app/models/agreement_item.rb +4 -0
  10. data/app/models/agreement_item_type.rb +4 -0
  11. data/app/models/agreement_party_role.rb +6 -0
  12. data/app/models/agreement_relationship.rb +32 -0
  13. data/app/models/agreement_reln_type.rb +7 -0
  14. data/app/models/agreement_role_type.rb +4 -0
  15. data/app/models/agreement_type.rb +4 -0
  16. data/app/models/extensions/party.rb +4 -0
  17. data/app/models/loyalty_program_code.rb +5 -0
  18. data/app/views/layouts/erp_agreements/application.html.erb +14 -0
  19. data/config/initializers/has_many_polymorphic.rb +1 -0
  20. data/config/routes.rb +2 -0
  21. data/db/migrate/20080805000070_agreements_services.rb +159 -0
  22. data/db/migrate/20080805000071_agreements_services_indexes.rb +51 -0
  23. data/lib/erp_agreements.rb +4 -0
  24. data/lib/erp_agreements/engine.rb +6 -0
  25. data/lib/erp_agreements/version.rb +3 -0
  26. data/lib/tasks/erp_agreements_tasks.rake +4 -0
  27. data/spec/dummy/Rakefile +7 -0
  28. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  29. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  30. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  31. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  32. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  33. data/spec/dummy/config.ru +4 -0
  34. data/spec/dummy/config/application.rb +44 -0
  35. data/spec/dummy/config/boot.rb +10 -0
  36. data/spec/dummy/config/database.yml +8 -0
  37. data/spec/dummy/config/environment.rb +5 -0
  38. data/spec/dummy/config/environments/spec.rb +27 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/inflections.rb +10 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  43. data/spec/dummy/config/initializers/session_store.rb +8 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  45. data/spec/dummy/config/locales/en.yml +5 -0
  46. data/spec/dummy/config/routes.rb +4 -0
  47. data/spec/dummy/public/404.html +26 -0
  48. data/spec/dummy/public/422.html +26 -0
  49. data/spec/dummy/public/500.html +26 -0
  50. data/spec/dummy/public/favicon.ico +0 -0
  51. data/spec/dummy/script/rails +6 -0
  52. data/spec/factories/agreement.rb +4 -0
  53. data/spec/factories/agreement_item.rb +4 -0
  54. data/spec/factories/agreement_item_type.rb +4 -0
  55. data/spec/factories/agreement_party_role.rb +4 -0
  56. data/spec/factories/agreement_relationship.rb +4 -0
  57. data/spec/factories/agreement_reln_type.rb +4 -0
  58. data/spec/models/agreement_item_spec.rb +11 -0
  59. data/spec/models/agreement_item_type_spec.rb +11 -0
  60. data/spec/models/agreement_party_role_spec.rb +12 -0
  61. data/spec/models/agreement_relationship_spec.rb +55 -0
  62. data/spec/models/agreement_reln_type_spec.rb +12 -0
  63. data/spec/models/agreement_role_type_spec.rb +13 -0
  64. data/spec/models/agreement_spec.rb +63 -0
  65. data/spec/models/agreement_type_spec.rb +11 -0
  66. data/spec/models/loyalty_program_code_spec.rb +12 -0
  67. data/spec/spec_helper.rb +61 -0
  68. metadata +191 -0
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :erp_agreements do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,44 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require "erp_base_erp_svcs"
7
+ require "erp_tech_svcs"
8
+ require "erp_agreements"
9
+
10
+ module Dummy
11
+ class Application < Rails::Application
12
+ # Settings in config/environments/* take precedence over those specified here.
13
+ # Application configuration should go into files in config/initializers
14
+ # -- all .rb files in that directory are automatically loaded.
15
+
16
+ # Custom directories with classes and modules you want to be autoloadable.
17
+ # config.autoload_paths += %W(#{config.root}/extras)
18
+
19
+ # Only load the plugins named here, in the order given (default is alphabetical).
20
+ # :all can be used as a placeholder for all plugins not explicitly named.
21
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
22
+
23
+ # Activate observers that should always be running.
24
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
25
+
26
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
27
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
28
+ # config.time_zone = 'Central Time (US & Canada)'
29
+
30
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
+ # config.i18n.default_locale = :de
33
+
34
+ # Configure the default encoding used in templates for Ruby 1.9.
35
+ config.encoding = "utf-8"
36
+
37
+ # Configure sensitive parameters which will be filtered from the log file.
38
+ config.filter_parameters += [:password]
39
+
40
+ # Enable the asset pipeline
41
+ config.assets.enabled = true
42
+ end
43
+ end
44
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,8 @@
1
+ # Warning: The database defined as "test" will be erased and
2
+ # re-generated from your development database when you run "rake".
3
+ # Do not set this db to the same as development or production.
4
+ spec:
5
+ adapter: sqlite3
6
+ database: db/spec.sqlite3
7
+ pool: 5
8
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,27 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Do not compress assets
26
+ config.assets.compress = false
27
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'ae0d58840f73a49e40850c9d815a6a135e169865cdb8721cec7f335a738af09f3483de0f99d7c131f8fdecf2d8b508f8fd5e2e33c8d0565dcc9030eadb227695'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActionController::Base.wrap_parameters :format => [:json]
8
+
9
+ # Disable root element in JSON by default.
10
+ if defined?(ActiveRecord)
11
+ ActiveRecord::Base.include_root_in_json = false
12
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+ mount ErpAgreements::Engine => "/erp_agreements"
3
+ mount ErpTechSvcs::Engine => "/erp_tech_svcs"
4
+ end
@@ -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,26 @@
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
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </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,4 @@
1
+ FactoryGirl.define do
2
+ factory :agreement do |a|
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :agreement_item do |ai|
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :agreement_item_type do |ait|
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :agreement_party_role do |apr|
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :agreement_relationship do |a|
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :agreement_reln_type do |a|
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe AgreementItem do
4
+ it "can be instantiated" do
5
+ AgreementItem.new.should be_an_instance_of(AgreementItem)
6
+ end
7
+
8
+ it "can be saved successfully" do
9
+ AgreementItem.create().should be_persisted
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe AgreementItemType do
4
+ it "can be instantiated" do
5
+ AgreementItemType.new.should be_an_instance_of(AgreementItemType)
6
+ end
7
+
8
+ it "can be saved successfully" do
9
+ AgreementItemType.create().should be_persisted
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe AgreementPartyRole do
4
+ it "can be instantiated" do
5
+ AgreementPartyRole.new.should be_an_instance_of(AgreementPartyRole)
6
+ end
7
+
8
+ it "can be saved successfully" do
9
+ AgreementPartyRole.create().should be_persisted
10
+ end
11
+ end
12
+
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe AgreementRelationship do
4
+ it "can be instantiated" do
5
+ AgreementRelationship.new.should be_an_instance_of(AgreementRelationship)
6
+ end
7
+
8
+ it "can be saved successfully" do
9
+ AgreementRelationship.create().should be_persisted
10
+ end
11
+
12
+ describe "can return an instance of this class with the from_role, to_role and relationship_type set" do
13
+
14
+ before(:each) do
15
+ #TODO this needs to factored to use erp_base_base_erp_svcs factories
16
+ @seller_role_type = AgreementRoleType.create(:description => 'seller', :internal_identifier => 'seller')
17
+ @buyer_role_type = AgreementRoleType.create(:description => 'buyer', :internal_identifier => 'buyer')
18
+
19
+ @agreement_reln_type = Factory(:agreement_reln_type,
20
+ :description => 'Buyer Seller',
21
+ :internal_identifier => 'buyer_seller',
22
+ :valid_from_role => @seller_role_type,
23
+ :valid_to_role => @buyer_role_type)
24
+ end
25
+
26
+ it "has method to take AgreementRelnType instance" do
27
+ agreement_relationship = AgreementRelationship.for_relationship_type(@agreement_reln_type)
28
+
29
+ agreement_relationship.should be_an_instance_of(AgreementRelationship)
30
+ agreement_relationship.from_role.id.should eq @seller_role_type.id
31
+ agreement_relationship.to_role.id.should eq @buyer_role_type.id
32
+ agreement_relationship.relationship_type.id.should eq @agreement_reln_type.id
33
+ end
34
+
35
+ it "has method (for_relationship_type_identifier) to take internal identifer of AgreementRelnType" do
36
+ agreement_relationship = AgreementRelationship.for_relationship_type_identifier('buyer_seller')
37
+
38
+ agreement_relationship.should be_an_instance_of(AgreementRelationship)
39
+ agreement_relationship.from_role.id.should eq @seller_role_type.id
40
+ agreement_relationship.to_role.id.should eq @buyer_role_type.id
41
+ agreement_relationship.relationship_type.id.should eq @agreement_reln_type.id
42
+ end
43
+
44
+ it "has shortcut method (for_reln_type_id) to take internal identifer of AgreementRelnType" do
45
+ agreement_relationship = AgreementRelationship.for_reln_type_id('buyer_seller')
46
+
47
+ agreement_relationship.should be_an_instance_of(AgreementRelationship)
48
+ agreement_relationship.from_role.id.should eq @seller_role_type.id
49
+ agreement_relationship.to_role.id.should eq @buyer_role_type.id
50
+ agreement_relationship.relationship_type.id.should eq @agreement_reln_type.id
51
+ end
52
+
53
+ end
54
+
55
+ end