Skip to content

Commit

Permalink
Skip symlink specs where symlink isn't implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Dec 1, 2010
1 parent a0b77e4 commit e1f296e
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions spec/warbler/task_spec.rb
Expand Up @@ -112,24 +112,32 @@ def run_task(t)
File.exist?('app/helpers/application_helper.class').should be_false
end

it "should process symlinks by storing a file in the archive that has the same contents as the source" do
File.open("config/special.txt", "wb") {|f| f << "special"}
Dir.chdir("config") { ln_s "special.txt", "link.txt" }
silence { run_task "warble" }
Zip::ZipFile.open("#{config.jar_name}.war") do |zf|
special = zf.get_input_stream('WEB-INF/config/special.txt') {|io| io.read }
link = zf.get_input_stream('WEB-INF/config/link.txt') {|io| io.read }
link.should == special
end
end

it "should process directory symlinks by copying the whole subdirectory" do
Dir.chdir("lib") { ln_s "tasks", "rakelib" }
silence { run_task "warble" }
Zip::ZipFile.open("#{config.jar_name}.war") do |zf|
zf.find_entry("WEB-INF/lib/tasks/utils.rake").should_not be_nil
zf.find_entry("WEB-INF/lib/rakelib/").should_not be_nil
zf.find_entry("WEB-INF/lib/rakelib/utils.rake").should_not be_nil if defined?(JRUBY_VERSION)
context "where symlinks are available" do
begin
ln_s "README.txt", "r.txt.symlink"
it "should process symlinks by storing a file in the archive that has the same contents as the source" do
File.open("config/special.txt", "wb") {|f| f << "special"}
Dir.chdir("config") { ln_s "special.txt", "link.txt" }
silence { run_task "warble" }
Zip::ZipFile.open("#{config.jar_name}.war") do |zf|
special = zf.get_input_stream('WEB-INF/config/special.txt') {|io| io.read }
link = zf.get_input_stream('WEB-INF/config/link.txt') {|io| io.read }
link.should == special
end
end

it "should process directory symlinks by copying the whole subdirectory" do
Dir.chdir("lib") { ln_s "tasks", "rakelib" }
silence { run_task "warble" }
Zip::ZipFile.open("#{config.jar_name}.war") do |zf|
zf.find_entry("WEB-INF/lib/tasks/utils.rake").should_not be_nil
zf.find_entry("WEB-INF/lib/rakelib/").should_not be_nil
zf.find_entry("WEB-INF/lib/rakelib/utils.rake").should_not be_nil if defined?(JRUBY_VERSION)
end
end

rm_f "r.txt.symlink"
rescue NotImplementedError
end
end

Expand Down

0 comments on commit e1f296e

Please sign in to comment.