spec/vendorer_spec.rb in vendorer-0.1.8 vs spec/vendorer_spec.rb in vendorer-0.1.9
- old
+ new
@@ -344,11 +344,11 @@
it "installs recursive submodules from a branch" do
create_git_repo 'a', 'git submodule add `cd ../../../.git && pwd` sub_a'
create_git_repo 'b', 'touch .gitmodules'
# create submodules on a branch
- run "cd b && git co -b with_submodules"
+ run "cd b && git checkout -b with_submodules"
run "cd b && git submodule add `cd ../a/.git && pwd` sub_b"
run "cd b && git add . && git commit -am 'submodules'"
run "cd b && git checkout master"
vendorer.folder 'plugin', 'b/.git', :branch => 'with_submodules'
@@ -378,8 +378,40 @@
it "executes inside vendorer" do
$test = 1
v = Vendorer.new
v.parse '$test = self'
$test.should == v
+ 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
+
+ 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 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