From 60d0bcc1de340d29c5bad3c707b49be7195e119b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20'Flameeyes'=20Petten=C3=B2?= Date: Sat, 5 Sep 2009 21:52:18 +0200 Subject: [PATCH 1/2] Make sure the Gruff::Layer::filenames array is sorted when creating. If the array is not sorted, the rest of the class fails to work as intended and the tests fail: 2) Failure: test_layer(TestGruffScene) [./test/test_scene.rb:54]: <["cloudy.png", "partly_cloudy.png", "stormy.png"]> expected but was <["stormy.png", "partly_cloudy.png", "cloudy.png"]>. and 2) Failure: test_layer(TestGruffScene) [./test/test_scene.rb:61]: <"1200.png"> expected but was <"0600.png">. --- lib/gruff/scene.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/gruff/scene.rb b/lib/gruff/scene.rb index 47943db..ef93656 100644 --- a/lib/gruff/scene.rb +++ b/lib/gruff/scene.rb @@ -133,7 +133,7 @@ class Gruff::Layer def initialize(base_dir, folder_name) @base_dir = base_dir.to_s @name = folder_name.to_s - @filenames = Dir.open(File.join(base_dir, folder_name)).entries.select { |file| file =~ /^[^.]+\.png$/ } + @filenames = Dir.open(File.join(base_dir, folder_name)).entries.select { |file| file =~ /^[^.]+\.png$/ }.sort @selected_filename = select_default end -- 1.6.4.2