spec/vendorer_spec.rb in vendorer-0.1.9 vs spec/vendorer_spec.rb in vendorer-0.1.10
- old
+ new
@@ -184,10 +184,18 @@
vendorer
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"]
+ 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')
end
@@ -301,10 +309,17 @@
end
"
vendorer
read('public/javascripts/jquery.js').should include('jQuery')
end
+
+ it "can handle trailing slash" do
+ write 'Vendorfile', read('Vendorfile').sub("javascripts' do", "javascripts/' do")
+ output = vendorer
+ read('public/javascripts/jquery.js').should include('jQuery')
+ output.should_not include('//')
+ end
end
context "submodules" do
def create_git_repo(folder, command)
# create a git repo with a submodule
@@ -379,39 +394,51 @@
$test = 1
v = Vendorer.new
v.parse '$test = self'
$test.should == v
end
+
+ it "fails with a nice backtrace" do
+ write 'Vendorfile', "\n\nfile 'XXX'\n\n"
+ output = vendorer '', :raise => true
+ output.should include("from Vendorfile:3:in `parse")
+ end
end
describe "#init" do
it "creates a Vendorfile via cli" do
vendorer("init")
read("Vendorfile").should include("folder")
end
- it "creates a Vendorfile via ruby" do
- Vendorer.new('init').init
- read("Vendorfile").should include("folder")
- end
+ context "from ruby" do
+ before do
+ Dir.chdir '../../' if RUBY_VERSION < '1.9'
+ end
- it "created Vendorfile contains commented out examples" do
- Vendorer.new('init').init
- read("Vendorfile").split("\n").each{|l| l.should =~ /^(#|\s*$)/ }
- end
+ it "creates a Vendorfile via ruby" do
+ Vendorer.new('init').init
+ read("Vendorfile").should include("folder")
+ end
- it "created Vendorfile contains many examples" do
- Vendorer.new('init').init
- read("Vendorfile").should include("folder 'vendor/")
- read("Vendorfile").should include("file 'vendor/")
- read("Vendorfile").should include("rewrite(path)")
- end
+ it "created Vendorfile contains commented out examples" do
+ Vendorer.new('init').init
+ read("Vendorfile").split("\n").each{|l| l.should =~ /^(#|\s*$)/ }
+ end
- it "created Vendorfile does not contain other instructions" do
- Vendorer.new('init').init
- read("Vendorfile").should_not include("vendorer init")
- read("Vendorfile").should_not include("Gemfile")
- read("Vendorfile").should_not include("gem install")
- read("Vendorfile").should_not include("```")
+ it "created Vendorfile contains many examples" do
+ Vendorer.new('init').init
+ read("Vendorfile").should include("folder 'vendor/")
+ read("Vendorfile").should include("file 'vendor/")
+ read("Vendorfile").should include("rewrite(path)")
+ end
+
+ it "created Vendorfile does not contain other instructions" do
+ Vendorer.new('init').init
+ read("Vendorfile").should_not include("vendorer init")
+ read("Vendorfile").should_not include("Gemfile")
+ read("Vendorfile").should_not include("gem install")
+ read("Vendorfile").should_not include("```")
+ end
end
end
end