spec/samples/samples_regression_spec.rb in squib-0.9.0 vs spec/samples/samples_regression_spec.rb in squib-0.10.0
- old
+ new
@@ -1,16 +1,10 @@
require 'spec_helper'
require 'squib'
require 'pp'
-describe "Squib samples" do
-
- around(:each) do |example|
- Dir.chdir(samples_dir) do
- example.run
- end
- end
+describe 'Squib samples' do
# This test could use some explanation
# Much of the development of Squib has been sample-driven. Every time I want
# new syntax or feature, I write a sample, get it working, and then write
# tests for boundary cases in the unit tests.
@@ -36,34 +30,38 @@
# Has to do with UTF-8 encoding of a special characters
# layouts.rb
# These are samples that don't really need a regression log
# colors.rb
# unicode.rb
- %w( autoscale_font.rb
+ %w(
+ autoscale_font/_autoscale_font.rb
basic.rb
cairo_access.rb
- csv_import.rb
+ colors/_gradients.rb
config_text_markup.rb
custom_config.rb
- draw_shapes.rb
+ data/_csv.rb
+ data/_excel.rb
embed_text.rb
- excel.rb
- gradients.rb
- hand.rb
hello_world.rb
- load_images.rb
- portrait-landscape.rb
+ images/_more_load_images.rb
ranges.rb
- saves.rb
- showcase.rb
+ saves/_hand.rb
+ saves/_portrait_landscape.rb
+ saves/_saves.rb
+ saves/_showcase.rb
+ shapes/_draw_shapes.rb
text_options.rb
tgc_proofs.rb
units.rb
).each do |sample|
it "has not changed for #{sample}", slow: true do
log = StringIO.new
mock_cairo(log)
- load sample
+ full_sample_path = File.expand_path "#{samples_dir}/#{sample}"
+ Dir.chdir(File.dirname("#{samples_dir}/#{sample}")) do
+ load full_sample_path
+ end
# overwrite_sample(sample, log) # Use TEMPORARILY once happy with the new sample log
test_file_str = File.open(sample_regression_file(sample), 'r:UTF-8').read
expect(log.string).to eq(test_file_str)
end
end