test/juicer/command/test_merge.rb in juicer-0.2.1 vs test/juicer/command/test_merge.rb in juicer-0.2.3
- old
+ new
@@ -53,11 +53,11 @@
end
end
def test_output_name_from_file_should_have_suffix_prepended_with_min
Juicer::Command::Merge.publicize_methods do
- assert_equal "test.min.js", @merge.output("test.js")
+ assert_equal File.expand_path("test.min.js"), @merge.output("test.js")
end
end
def test_output_name_from_nothing_should_be_timestamp
Juicer::Command::Merge.publicize_methods do
@@ -66,15 +66,22 @@
end
def test_output_name_instance_value
Juicer::Command::Merge.publicize_methods do
@merge.instance_eval { @output = "output.css" }
- assert_equal "output.css", @merge.output
- assert_equal "output.css", @merge.output("bleh.css")
+ assert_equal File.expand_path("output.css"), @merge.output
+ assert_equal File.expand_path("output.css"), @merge.output("bleh.css")
end
end
+ def test_output_name_should_be_generated_when_output_is_directory
+ Juicer::Command::Merge.publicize_methods do
+ @merge.instance_eval { @output = path("css") }
+ assert_equal File.join(path("css"), "file.min.css"), @merge.output("file.css")
+ end
+ end
+
def test_merger_from_valid_type
Juicer::Command::Merge.publicize_methods do
assert_equal Juicer::Merger::JavaScriptMerger, @merge.merger("bleh.js")
end
end
@@ -113,14 +120,14 @@
assert_match(/Run again with --force to overwrite/, @io.string)
end
end
def test_update_output_when_force
- assert_nothing_raised do
- @merge.instance_eval { @force = true }
- @merge.execute(path("a.css"))
- end
+ assert_nothing_raised do
+ @merge.instance_eval { @force = true }
+ @merge.execute(path("a.css"))
+ end
end
def test_merge_successful
begin
@merge.instance_eval { @output = path("a.min.css") }
@@ -148,8 +155,6 @@
@merge.execute(path("not-ok.js"))
assert_match(/Problems were detected during verification/, @io.string)
assert_match(/Ignoring detected problems/, @io.string)
end
end
-
-
end