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
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AgreementRelnType do
|
4
|
+
it "can be instantiated" do
|
5
|
+
AgreementRelnType.new.should be_an_instance_of(AgreementRelnType)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "can be saved successfully" do
|
9
|
+
AgreementRelnType.create().should be_persisted
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AgreementRoleType do
|
4
|
+
it "can be instantiated" do
|
5
|
+
AgreementRoleType.new.should be_an_instance_of(AgreementRoleType)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "can be saved successfully" do
|
9
|
+
AgreementRoleType.create().should be_persisted
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Agreement do
|
4
|
+
it "can be instantiated" do
|
5
|
+
agreement = Factory.build(:agreement, :description => 'My Agreement')
|
6
|
+
agreement.should be_an_instance_of(Agreement)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "can be saved successfully" do
|
10
|
+
agreement = Factory.build(:agreement, :description => 'My Agreement')
|
11
|
+
agreement.save.should eq true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "can use agreement items as methods" do
|
15
|
+
agreement_item_type = Factory.build(:agreement_item_type, :internal_identifier => 'reference_number')
|
16
|
+
agreement_item = Factory.build(:agreement_item, :agreement_item_type => agreement_item_type, :agreement_item_value => '1234ABCD')
|
17
|
+
agreement = Factory.build(:agreement, :description => 'My Agreement')
|
18
|
+
agreement.items << agreement_item
|
19
|
+
agreement.save!
|
20
|
+
agreement.reference_number.should == '1234ABCD'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "can have agreement relationships" do
|
24
|
+
agreement_reln_type = Factory.build(:agreement_reln_type, :internal_identifier => 'test_reln_type', :description => 'test reln type')
|
25
|
+
agreement_reln = Factory.build(:agreement_relationship, :description => 'test reln',
|
26
|
+
:relationship_type => agreement_reln_type)
|
27
|
+
agreement_one = Factory.build(:agreement, :description => 'Agreement One')
|
28
|
+
agreement_two = Factory.build(:agreement, :description => 'Agreement two')
|
29
|
+
|
30
|
+
agreement_reln.agreement_from = agreement_one
|
31
|
+
agreement_reln.agreement_to = agreement_two
|
32
|
+
agreement_reln.save
|
33
|
+
|
34
|
+
agreement_one.agreement_relationships.collect(&:description).first.should eq "test reln"
|
35
|
+
agreement_two.agreement_relationships.collect(&:description).first.should eq "test reln"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "has a method to_s that returns description" do
|
39
|
+
agreement = Factory(:agreement, :description => 'My Agreement')
|
40
|
+
agreement.to_s.should eq 'My Agreement'
|
41
|
+
end
|
42
|
+
|
43
|
+
it "has a method to_label that calls to_s which returns description" do
|
44
|
+
agreement = Factory(:agreement, :description => 'My Agreement')
|
45
|
+
agreement.to_label.should eq 'My Agreement'
|
46
|
+
end
|
47
|
+
|
48
|
+
it "can find paties by roles" do
|
49
|
+
#TODO this needs to factored to use erp_base_base_erp_svcs factories
|
50
|
+
party = Factory(:party, :description => 'Joe Smith')
|
51
|
+
role_type = Factory(:role_type, :description => 'owner', :internal_identifier => 'owner')
|
52
|
+
|
53
|
+
agreement = Factory(:agreement, :description => 'My Agreement')
|
54
|
+
agreement_party_role = Factory(:agreement_party_role,
|
55
|
+
:description => 'My Agreement',
|
56
|
+
:role_type => role_type,
|
57
|
+
:party => party,
|
58
|
+
:agreement => agreement)
|
59
|
+
|
60
|
+
agreement.find_parties_by_role(RoleType.iid('owner')).first.id.should eq party.id
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LoyaltyProgramCode do
|
4
|
+
it "can be instantiated" do
|
5
|
+
LoyaltyProgramCode.new.should be_an_instance_of(LoyaltyProgramCode)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "can be saved successfully" do
|
9
|
+
LoyaltyProgramCode.create().should be_persisted
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spork'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
Spork.prefork do
|
5
|
+
# Loading more in this block will cause your tests to run faster. However,
|
6
|
+
# if you change any configuration or code from libraries loaded here, you'll
|
7
|
+
# need to restart spork for it take effect.
|
8
|
+
|
9
|
+
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
10
|
+
DUMMY_APP_ROOT=File.join(File.dirname(__FILE__), '/dummy')
|
11
|
+
|
12
|
+
require 'active_support'
|
13
|
+
require 'active_model'
|
14
|
+
require 'active_record'
|
15
|
+
require 'action_controller'
|
16
|
+
|
17
|
+
# Configure Rails Envinronment
|
18
|
+
ENV["RAILS_ENV"] = "spec"
|
19
|
+
require File.expand_path(DUMMY_APP_ROOT + "/config/environment.rb", __FILE__)
|
20
|
+
|
21
|
+
ActiveRecord::Base.configurations = YAML::load(IO.read(DUMMY_APP_ROOT + "/config/database.yml"))
|
22
|
+
ActiveRecord::Base.establish_connection(ENV["DB"] || "spec")
|
23
|
+
ActiveRecord::Migration.verbose = false
|
24
|
+
|
25
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
26
|
+
# in spec/support/ and its subdirectories.
|
27
|
+
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
|
28
|
+
|
29
|
+
require 'rspec/rails'
|
30
|
+
require 'erp_dev_svcs'
|
31
|
+
|
32
|
+
RSpec.configure do |config|
|
33
|
+
config.use_transactional_fixtures = true
|
34
|
+
config.include Sorcery::TestHelpers::Rails
|
35
|
+
config.include ErpDevSvcs
|
36
|
+
config.include ErpDevSvcs::ControllerSupport, :type => :controller
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Spork.each_run do
|
41
|
+
#We have to execute the migrations from dummy app directory
|
42
|
+
Dir.chdir DUMMY_APP_ROOT
|
43
|
+
`rake db:drop`
|
44
|
+
Dir.chdir ENGINE_RAILS_ROOT
|
45
|
+
|
46
|
+
#We have to execute the migrations from dummy app directory
|
47
|
+
Dir.chdir DUMMY_APP_ROOT
|
48
|
+
`rake db:migrate`
|
49
|
+
Dir.chdir ENGINE_RAILS_ROOT
|
50
|
+
|
51
|
+
ErpDevSvcs::FactorySupport.load_engine_factories
|
52
|
+
|
53
|
+
require 'simplecov'
|
54
|
+
SimpleCov.start 'rails' do
|
55
|
+
add_filter "spec/"
|
56
|
+
end
|
57
|
+
#Need to explictly load the files in lib/ until we figure out how to
|
58
|
+
#get rails to autoload them for spec like it used to...
|
59
|
+
Dir[File.join(ENGINE_RAILS_ROOT, "lib/**/*.rb")].each {|f| load f}
|
60
|
+
Dir[File.join(ENGINE_RAILS_ROOT, "app/models/extensions/**/*.rb")].each {|f| load f}
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erp_agreements
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rick Koloski, Russell Holmes
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-06 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: erp_base_erp_svcs
|
16
|
+
requirement: &2157188160 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157188160
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: erp_tech_svcs
|
27
|
+
requirement: &2157187560 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157187560
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: erp_dev_svcs
|
38
|
+
requirement: &2157186740 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157186740
|
47
|
+
description: The Agreements Engine implements model classes for storing Contracts
|
48
|
+
and Agreements data, including AgreementItems, which represent the terms of the
|
49
|
+
Agreement. Contracts are a special case of Agreements, specifically Agreements which
|
50
|
+
are legal in nature. Agreements and Terms are often used as the execution context
|
51
|
+
of a rules engine to govern other behaviors of a system.
|
52
|
+
email:
|
53
|
+
- russonrails@gmail.com
|
54
|
+
executables: []
|
55
|
+
extensions: []
|
56
|
+
extra_rdoc_files: []
|
57
|
+
files:
|
58
|
+
- app/assets/javascripts/erp_agreements/application.js
|
59
|
+
- app/assets/stylesheets/erp_agreements/application.css
|
60
|
+
- app/controllers/erp_agreements/application_controller.rb
|
61
|
+
- app/helpers/erp_agreements/application_helper.rb
|
62
|
+
- app/models/agreement.rb
|
63
|
+
- app/models/agreement_item.rb
|
64
|
+
- app/models/agreement_item_type.rb
|
65
|
+
- app/models/agreement_party_role.rb
|
66
|
+
- app/models/agreement_relationship.rb
|
67
|
+
- app/models/agreement_reln_type.rb
|
68
|
+
- app/models/agreement_role_type.rb
|
69
|
+
- app/models/agreement_type.rb
|
70
|
+
- app/models/extensions/party.rb
|
71
|
+
- app/models/loyalty_program_code.rb
|
72
|
+
- app/views/layouts/erp_agreements/application.html.erb
|
73
|
+
- config/initializers/has_many_polymorphic.rb
|
74
|
+
- config/routes.rb
|
75
|
+
- db/migrate/20080805000070_agreements_services.rb
|
76
|
+
- db/migrate/20080805000071_agreements_services_indexes.rb
|
77
|
+
- lib/erp_agreements/engine.rb
|
78
|
+
- lib/erp_agreements/version.rb
|
79
|
+
- lib/erp_agreements.rb
|
80
|
+
- lib/tasks/erp_agreements_tasks.rake
|
81
|
+
- GPL-3-LICENSE
|
82
|
+
- Rakefile
|
83
|
+
- README.rdoc
|
84
|
+
- spec/dummy/app/assets/javascripts/application.js
|
85
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
86
|
+
- spec/dummy/app/controllers/application_controller.rb
|
87
|
+
- spec/dummy/app/helpers/application_helper.rb
|
88
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
89
|
+
- spec/dummy/config/application.rb
|
90
|
+
- spec/dummy/config/boot.rb
|
91
|
+
- spec/dummy/config/database.yml
|
92
|
+
- spec/dummy/config/environment.rb
|
93
|
+
- spec/dummy/config/environments/spec.rb
|
94
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
95
|
+
- spec/dummy/config/initializers/inflections.rb
|
96
|
+
- spec/dummy/config/initializers/mime_types.rb
|
97
|
+
- spec/dummy/config/initializers/secret_token.rb
|
98
|
+
- spec/dummy/config/initializers/session_store.rb
|
99
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
100
|
+
- spec/dummy/config/locales/en.yml
|
101
|
+
- spec/dummy/config/routes.rb
|
102
|
+
- spec/dummy/config.ru
|
103
|
+
- spec/dummy/public/404.html
|
104
|
+
- spec/dummy/public/422.html
|
105
|
+
- spec/dummy/public/500.html
|
106
|
+
- spec/dummy/public/favicon.ico
|
107
|
+
- spec/dummy/Rakefile
|
108
|
+
- spec/dummy/script/rails
|
109
|
+
- spec/factories/agreement.rb
|
110
|
+
- spec/factories/agreement_item.rb
|
111
|
+
- spec/factories/agreement_item_type.rb
|
112
|
+
- spec/factories/agreement_party_role.rb
|
113
|
+
- spec/factories/agreement_relationship.rb
|
114
|
+
- spec/factories/agreement_reln_type.rb
|
115
|
+
- spec/models/agreement_item_spec.rb
|
116
|
+
- spec/models/agreement_item_type_spec.rb
|
117
|
+
- spec/models/agreement_party_role_spec.rb
|
118
|
+
- spec/models/agreement_relationship_spec.rb
|
119
|
+
- spec/models/agreement_reln_type_spec.rb
|
120
|
+
- spec/models/agreement_role_type_spec.rb
|
121
|
+
- spec/models/agreement_spec.rb
|
122
|
+
- spec/models/agreement_type_spec.rb
|
123
|
+
- spec/models/loyalty_program_code_spec.rb
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
homepage: http://development.compassagile.com
|
126
|
+
licenses: []
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 1.8.10
|
146
|
+
signing_key:
|
147
|
+
specification_version: 3
|
148
|
+
summary: The Agreements Engine implements model classes for storing Contracts and
|
149
|
+
Agreements data, including AgreementItems, which represent the terms of the Agreement.
|
150
|
+
test_files:
|
151
|
+
- spec/dummy/app/assets/javascripts/application.js
|
152
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
153
|
+
- spec/dummy/app/controllers/application_controller.rb
|
154
|
+
- spec/dummy/app/helpers/application_helper.rb
|
155
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
156
|
+
- spec/dummy/config/application.rb
|
157
|
+
- spec/dummy/config/boot.rb
|
158
|
+
- spec/dummy/config/database.yml
|
159
|
+
- spec/dummy/config/environment.rb
|
160
|
+
- spec/dummy/config/environments/spec.rb
|
161
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
162
|
+
- spec/dummy/config/initializers/inflections.rb
|
163
|
+
- spec/dummy/config/initializers/mime_types.rb
|
164
|
+
- spec/dummy/config/initializers/secret_token.rb
|
165
|
+
- spec/dummy/config/initializers/session_store.rb
|
166
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
167
|
+
- spec/dummy/config/locales/en.yml
|
168
|
+
- spec/dummy/config/routes.rb
|
169
|
+
- spec/dummy/config.ru
|
170
|
+
- spec/dummy/public/404.html
|
171
|
+
- spec/dummy/public/422.html
|
172
|
+
- spec/dummy/public/500.html
|
173
|
+
- spec/dummy/public/favicon.ico
|
174
|
+
- spec/dummy/Rakefile
|
175
|
+
- spec/dummy/script/rails
|
176
|
+
- spec/factories/agreement.rb
|
177
|
+
- spec/factories/agreement_item.rb
|
178
|
+
- spec/factories/agreement_item_type.rb
|
179
|
+
- spec/factories/agreement_party_role.rb
|
180
|
+
- spec/factories/agreement_relationship.rb
|
181
|
+
- spec/factories/agreement_reln_type.rb
|
182
|
+
- spec/models/agreement_item_spec.rb
|
183
|
+
- spec/models/agreement_item_type_spec.rb
|
184
|
+
- spec/models/agreement_party_role_spec.rb
|
185
|
+
- spec/models/agreement_relationship_spec.rb
|
186
|
+
- spec/models/agreement_reln_type_spec.rb
|
187
|
+
- spec/models/agreement_role_type_spec.rb
|
188
|
+
- spec/models/agreement_spec.rb
|
189
|
+
- spec/models/agreement_type_spec.rb
|
190
|
+
- spec/models/loyalty_program_code_spec.rb
|
191
|
+
- spec/spec_helper.rb
|