spec/absorption_spec.rb in activefacts-0.6.0 vs spec/absorption_spec.rb in activefacts-0.7.0

- old
+ new

@@ -41,11 +41,11 @@ { :should => "inject a value column into the table for an independent ValueType", :cql => %Q{ #{Prologue} Month is in exactly one Season; }, - :tables => { "Month" => [ %w{Month Value}, "Season" ] } + :tables => { "Month" => [ "MonthValue", "Season" ] } }, { :should => "absorb a one-to-one along the identification path", :cql => %Q{ #{Prologue} #{Claim} #{Incident} @@ -62,11 +62,11 @@ Lodgement was made at at most one DateTime; Person has exactly one birth-Date; }, :tables => { "Claim" => ["ClaimID", %w{Lodgement DateTime}, %w{Lodgement Person ID}], - "Party" => ["PartyID", %w{Person birth Date}] + "Party" => ["PartyID", %w{Person Birth Date}] } }, ] @@ -79,16 +79,18 @@ expected_tables = test[:tables] it "should #{should}" do @compiler = ActiveFacts::Input::CQL.new(cql, should) @vocabulary = @compiler.read + # puts cql + # Ensure that the same tables were generated: - tables = @vocabulary.tables - tables.map(&:name).sort.should == expected_tables.keys.sort + tables = @vocabulary.tables.sort_by(&:name) + tables.map(&:name).should == expected_tables.keys.sort # Ensure that the same column descriptions were generated: - tables.sort_by(&:name).each do |table| - column_descriptions = table.absorbed_roles.all_role_ref.map{|rr| rr.column_name(nil) }.sort + tables.each do |table| + column_descriptions = table.columns.map{|col| col.name(nil) }.sort column_descriptions.should == expected_tables[table.name].map{|c| Array(c) }.sort end end end end