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