erp_agreements 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL-3-LICENSE +674 -0
- data/README.rdoc +2 -0
- data/Rakefile +31 -0
- data/app/assets/javascripts/erp_agreements/application.js +9 -0
- data/app/assets/stylesheets/erp_agreements/application.css +7 -0
- data/app/controllers/erp_agreements/application_controller.rb +4 -0
- data/app/helpers/erp_agreements/application_helper.rb +4 -0
- data/app/models/agreement.rb +42 -0
- data/app/models/agreement_item.rb +4 -0
- data/app/models/agreement_item_type.rb +4 -0
- data/app/models/agreement_party_role.rb +6 -0
- data/app/models/agreement_relationship.rb +32 -0
- data/app/models/agreement_reln_type.rb +7 -0
- data/app/models/agreement_role_type.rb +4 -0
- data/app/models/agreement_type.rb +4 -0
- data/app/models/extensions/party.rb +4 -0
- data/app/models/loyalty_program_code.rb +5 -0
- data/app/views/layouts/erp_agreements/application.html.erb +14 -0
- data/config/initializers/has_many_polymorphic.rb +1 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20080805000070_agreements_services.rb +159 -0
- data/db/migrate/20080805000071_agreements_services_indexes.rb +51 -0
- data/lib/erp_agreements.rb +4 -0
- data/lib/erp_agreements/engine.rb +6 -0
- data/lib/erp_agreements/version.rb +3 -0
- data/lib/tasks/erp_agreements_tasks.rake +4 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -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/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +44 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -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 +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/agreement.rb +4 -0
- data/spec/factories/agreement_item.rb +4 -0
- data/spec/factories/agreement_item_type.rb +4 -0
- data/spec/factories/agreement_party_role.rb +4 -0
- data/spec/factories/agreement_relationship.rb +4 -0
- data/spec/factories/agreement_reln_type.rb +4 -0
- data/spec/models/agreement_item_spec.rb +11 -0
- data/spec/models/agreement_item_type_spec.rb +11 -0
- data/spec/models/agreement_party_role_spec.rb +12 -0
- data/spec/models/agreement_relationship_spec.rb +55 -0
- data/spec/models/agreement_reln_type_spec.rb +12 -0
- data/spec/models/agreement_role_type_spec.rb +13 -0
- data/spec/models/agreement_spec.rb +63 -0
- data/spec/models/agreement_type_spec.rb +11 -0
- data/spec/models/loyalty_program_code_spec.rb +12 -0
- data/spec/spec_helper.rb +61 -0
- metadata +191 -0
data/spec/dummy/Rakefile
ADDED
@@ -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,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,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,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,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,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,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
|