activefacts-api 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 0.9.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "activefacts-api"
8
- s.version = "0.9.1"
8
+ s.version = "0.9.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Clifford Heath"]
@@ -217,7 +217,7 @@ module ActiveFacts
217
217
  # Find and return an existing instance matching this key
218
218
  instances = constellation.instances[self] # All instances of this class in this constellation
219
219
  instance = instances[key]
220
- # REVISIT: This ignores any additional attribute assignments
220
+ @created_instances ||= []
221
221
  if instance
222
222
  # raise "Additional role values are ignored when asserting an existing instance" if args[-1].is_a? Hash and !args[-1].empty?
223
223
  assign_additional_roles(instance, args[-1]) if args[-1].is_a? Hash and !args[-1].empty?
@@ -226,7 +226,6 @@ module ActiveFacts
226
226
 
227
227
  # Now construct each of this object's identifying roles
228
228
  irns = identifying_role_names
229
- @created_instances ||= []
230
229
 
231
230
  has_hash = args[-1].is_a?(Hash)
232
231
  if args.size == 1+(has_hash ? 1 : 0) and args[0].is_a?(self)
@@ -161,6 +161,11 @@ class AutoCounter
161
161
  end
162
162
  end
163
163
 
164
+ # if the value is unassigned, it equal?(:new).
165
+ def equal? value
166
+ value == :new ? @value == nil : super
167
+ end
168
+
164
169
  # An AutoCounter may only be used in numeric expressions after a definite value has been assigned
165
170
  def to_i
166
171
  raise ArgumentError, "Illegal attempt to get integer value of an uncommitted AutoCounter" unless @value
@@ -147,10 +147,16 @@ describe "A Constellation instance" do
147
147
  name1 = @constellation.Name("foo")
148
148
  foo1 = @constellation.LegalEntity("foo")
149
149
  acme1 = @constellation.Company("Acme, Inc", :auto_counter_val => :new)
150
+ acme1_id = acme1.auto_counter_val.to_s
150
151
 
151
152
  name2 = @constellation.Name("foo")
152
153
  foo2 = @constellation.LegalEntity("foo")
153
- lambda { @constellation.Company("Acme, Inc", :auto_counter_val => :new) }.should raise_error
154
+ acme2 = nil
155
+ lambda { acme2 = @constellation.Company("Acme, Inc", :auto_counter_val => :new) }.should_not raise_error
156
+ acme2.auto_counter_val = :new
157
+ acme2.should == acme1
158
+ acme2.auto_counter_val.should_not be_defined
159
+ acme2.auto_counter_val.to_s.should == acme1_id
154
160
  end
155
161
 
156
162
  it "should support methods to assert instances via the class for that type" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activefacts-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -202,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  segments:
204
204
  - 0
205
- hash: -115051205144526317
205
+ hash: -2189448494771312824
206
206
  required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  none: false
208
208
  requirements: