spec/vendorer_spec.rb in vendorer-0.1.11 vs spec/vendorer_spec.rb in vendorer-0.1.12
- old
+ new
@@ -93,11 +93,11 @@
it "fails with a nice message if the Vendorfile is broken" do
write 'Vendorfile', "file 'xxx.js', 'http://NOTFOUND'"
result = vendorer '', :raise => true
# different errors on travis / local
- raise result unless result.include?("resolve host 'NOTFOUND'") or result.include?('Downloaded empty file')
+ raise result unless result.include?("NOTFOUND") or result.include?('Downloaded empty file')
end
describe "with update" do
it "updates all files when update is called" do
simple_vendorfile
@@ -180,25 +180,25 @@
raise unless output.include?('Connection refused') or output.include?('resolve host')
end
it "can download from local" do
vendorer
- ls('').should == ["its_recursive", "Vendorfile"]
+ ls('').should =~ ["its_recursive", "Vendorfile"]
read('its_recursive/Gemfile').should include('rake')
end
it "can handle a trailing slash" do
write 'Vendorfile', "folder 'its_recursive/', '../../.git'"
output = vendorer
- ls('').should == ["its_recursive", "Vendorfile"]
+ ls('').should =~ ["its_recursive", "Vendorfile"]
read('its_recursive/Gemfile').should include('rake')
output.should_not include('//')
end
it "does not keep .git folder so everything can be checked in" do
vendorer
- ls('its_recursive/.git').first.should include('cannot access')
+ ls('its_recursive/.git').first.should =~ /cannot access|No such file or directory/
end
it "does not update an existing folder" do
vendorer
write('its_recursive/Gemfile', 'Foo')
@@ -472,32 +472,32 @@
from '../../.git' do
file 'Readme.md'
end
"
vendorer
- ls(".").should == ['Readme.md', 'Vendorfile']
+ ls(".").should =~ ['Readme.md', 'Vendorfile']
end
it "copies to/from a nested location" do
write "Vendorfile", "
from '../../.git' do
file 'foo/bar/renamed.rb', 'lib/vendorer.rb'
end
"
vendorer
- ls(".").should == ['foo', 'Vendorfile']
- ls("./foo/bar").should == ['renamed.rb']
+ ls(".").should =~ ['foo', 'Vendorfile']
+ ls("./foo/bar").should =~ ['renamed.rb']
end
it "renames" do
write "Vendorfile", "
from '../../.git' do
file 'Readme.renamed', 'Readme.md'
end
"
vendorer
- ls(".").should == ['Readme.renamed', 'Vendorfile']
+ ls(".").should =~ ['Readme.renamed', 'Vendorfile']
end
end
context "with folder" do
it "copies" do
@@ -505,33 +505,50 @@
from '../../.git' do
folder 'lib'
end
"
vendorer
- ls(".").should == ['lib', 'Vendorfile']
- ls("./lib").should == ['vendorer', 'vendorer.rb']
+ ls(".").should =~ ['lib', 'Vendorfile']
+ ls("./lib").should =~ ['vendorer', 'vendorer.rb']
end
it "copies to/from a nested location" do
write "Vendorfile", "
from '../../.git' do
folder 'foo/bar', 'lib/vendorer'
end
"
vendorer
- ls(".").should == ['foo', 'Vendorfile']
- ls("./foo/bar").should == ['version.rb']
+ ls(".").should =~ ['foo', 'Vendorfile']
+ ls("./foo/bar").should =~ ['version.rb']
end
it "renames" do
write "Vendorfile", "
from '../../.git' do
folder 'foo', 'lib'
end
"
vendorer
- ls(".").should == ['foo', 'Vendorfile']
- ls("./foo").should == ['vendorer', 'vendorer.rb']
+ ls(".").should =~ ['foo', 'Vendorfile']
+ ls("./foo").should =~ ['vendorer', 'vendorer.rb']
+ end
+ end
+
+ context "with folder nesting" do
+ it "copies" do
+ write "Vendorfile", "
+ folder 'foo' do
+ from '../../.git' do
+ folder 'lib'
+ file 'Gemfile'
+ end
+ end
+ "
+ vendorer
+ ls(".").should =~ ['foo', 'Vendorfile']
+ ls("./foo").should =~ ['Gemfile', 'lib']
+ ls("./foo/lib").should =~ ['vendorer', 'vendorer.rb']
end
end
it "gives 'not found' error for non-existent file" do
write "Vendorfile", "