spec/norma_cql_spec.rb in activefacts-0.8.16 vs spec/norma_cql_spec.rb in activefacts-0.8.18

- old
+ new

@@ -10,16 +10,16 @@ require 'activefacts/input/orm' require 'activefacts/generate/cql' describe "Norma Loader" do orm_failures = { - "SubtypePI" => "Has an illegal uniqueness join constraint", + "SubtypePI" => "Has an illegal uniqueness constraint", } orm_cql_failures = { # "OddIdentifier" => "Strange identification pattern is incorrectly verbalised to CQL", # Fixed "UnaryIdentification" => "No PI for VisitStatus", - "Supervision" => "Join constraints not imported from NORMA", + "Supervision" => "Derivations are not imported from NORMA", } # Generate and return the CQL for the given vocabulary def cql(vocabulary) output = StringIO.new @dumper = ActiveFacts::Generate::CQL.new(vocabulary.constellation) @@ -32,19 +32,22 @@ Dir["examples/norma/#{pattern}.orm"].each do |orm_file| expected_file = orm_file.sub(%r{/norma/(.*).orm\Z}, '/CQL/\1.cql') actual_file = orm_file.sub(%r{examples/norma/(.*).orm\Z}, 'spec/actual/\1.cql') base = File.basename(orm_file, ".orm") + next unless ENV["AFTESTS"] || File.exists?(expected_file) + it "should load #{orm_file} and dump CQL matching #{expected_file}" do begin vocabulary = ActiveFacts::Input::ORM.readfile(orm_file) rescue => e raise unless orm_failures.include?(base) pending orm_failures[base] end cql_text = cql(vocabulary) # Save the actual file: + Dir.mkdir "spec/actual" rescue nil File.open(actual_file, "w") { |f| f.write cql_text } pending("expected output file #{expected_file} not found") unless File.exists? expected_file expected_text = File.open(expected_file) {|f| f.read }