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

- old
+ new

@@ -36,22 +36,26 @@ pattern = ENV["AFTESTS"] || "*" Dir["examples/CQL/#{pattern}.cql"].each do |cql_file| expected_file = cql_file.sub(%r{/CQL/(.*).cql\Z}, '/ruby/\1.rb') actual_file = cql_file.sub(%r{examples/CQL/(.*).cql\Z}, 'spec/actual/\1.rb') + next unless ENV["AFTESTS"] || File.exists?(expected_file) + it "should load #{cql_file} and dump Ruby matching #{expected_file}" do vocabulary = nil broken = cql_failures[File.basename(cql_file, ".cql")] if broken pending(broken) { vocabulary = ActiveFacts::Input::CQL.readfile(cql_file) } else vocabulary = ActiveFacts::Input::CQL.readfile(cql_file) end + vocabulary.finalise # Build and save the actual file: ruby_text = ruby(vocabulary) + Dir.mkdir "spec/actual" rescue nil File.open(actual_file, "w") { |f| f.write ruby_text } pending("expected output file #{expected_file} not found") unless File.exists? expected_file expected_text = File.open(expected_file) {|f| f.read }