spec/cql/role_matching_spec.rb in activefacts-0.8.10 vs spec/cql/role_matching_spec.rb in activefacts-0.8.12
- old
+ new
@@ -1,16 +1,17 @@
#
# ActiveFacts CQL Fact Type matching tests
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
#
+$: << Dir::getwd
require 'rspec/expectations'
require 'activefacts/support'
require 'activefacts/api/support'
require 'activefacts/cql/compiler'
-require 'spec/helpers/compile_helpers'
+require File.dirname(__FILE__) + '/../helpers/compile_helpers'
describe "When comparing roles of a reading with an existing reading" do
before :each do
extend CompileHelpers
@@ -46,27 +47,27 @@
it "should match exact reading" do
parse %q{Boy is going out with Girl;}
@asts.size.should == 1
side_effects = match_readings_to_existing(@asts[0], @simple_ft.all_reading.single)
side_effects[0].should_not be_nil
- side_effects.to_s.should == 'side-effects are [{Boy} absorbs 0/0 at 0, {Girl} absorbs 0/0 at 5]'
+ side_effects.to_s.should == '[side-effects are [{Boy} absorbs 0/0 at 0, {Girl} absorbs 0/0 at 5]]'
end
it "should match with explicit leading adjective" do
parse %q{Boy dislikes ugly-Girl;}
@asts.size.should == 1
side_effects = match_readings_to_existing(@asts[0], @ugly_ft.all_reading.single)
side_effects[0].should_not be_nil
- side_effects.to_s.should == 'side-effects are [{Boy} absorbs 0/0 at 0, {ugly- Girl} absorbs 0/0 at 2]'
+ side_effects.to_s.should == '[side-effects are [{Boy} absorbs 0/0 at 0, {ugly- Girl} absorbs 0/0 at 2]]'
end
it "should match with implicit leading adjective" do
parse %q{Boy dislikes ugly Girl;}
@asts.size.should == 1
side_effects = match_readings_to_existing(@asts[0], @ugly_ft.all_reading.single)
side_effects[0].should_not be_nil
- side_effects.to_s.should == 'side-effects are [{Boy} absorbs 0/0 at 0, {Girl} absorbs 1/0 at 3]'
+ side_effects.to_s.should == '[side-effects are [{Boy} absorbs 0/0 at 0, {Girl} absorbs 1/0 at 3]]'
end
it "should match with local leading adjective" do
parse %q{
bad-Boy is going out with Girl,
@@ -102,19 +103,19 @@
parse %q{Boy-monster hurts Girl;}
@asts.size.should == 1
side_effects = match_readings_to_existing(@asts[0], @hurts_ft.all_reading.single)
pending "Thinks trailing adjectives are always residual"
side_effects[0].should_not be_nil
- side_effects.to_s.should == ''
+ side_effects[0].to_s.should == ''
end
it "should match with implicit trailing adjective" do
parse %q{Boy monster hurts Girl;}
@asts.size.should == 1
side_effects = match_readings_to_existing(@asts[0], @hurts_ft.all_reading.single)
side_effects[0].should_not be_nil
- side_effects.to_s.should == 'side-effects are [{Boy} absorbs 0/1 at 0, {Girl} absorbs 0/0 at 3]'
+ side_effects.to_s.should == '[side-effects are [{Boy} absorbs 0/1 at 0, {Girl} absorbs 0/0 at 3]]'
end
it "should match with local trailing adjective" do
parse %q{
Boy is going out with Girl-troublemaker,
@@ -122,10 +123,10 @@
}
@asts.size.should == 1
side_effects = match_readings_to_existing(@asts[0], @simple_ft.all_reading.single)
side_effects.size.should == 2
side_effects[0].should_not be_nil
- side_effects.to_s.should == 'side-effects are [{Boy} absorbs 0/0 at 0, {Girl -troublemaker} absorbs 0/0 at 5 with residual adjectives] with residual adjectives'
+ side_effects.to_s.should == '[side-effects are [{Boy} absorbs 0/0 at 0, {Girl -troublemaker} absorbs 0/0 at 5 with residual adjectives] with residual adjectives, nil]'
end
it "should match with explicit and local trailing adjective" do
parse %q{
Boy monster -foo hurts Girl,