spec/vendorer_spec.rb in vendorer-0.1.5 vs spec/vendorer_spec.rb in vendorer-0.1.6

- old
+ new

@@ -36,15 +36,15 @@ out = `cd spec/tmp && bundle exec ../../bin/vendorer #{args} 2>&1` raise out if $?.success? == !!options[:raise] out end - describe 'version' do - it "has a VERSION" do - Vendorer::VERSION.should =~ /^[\.\da-z]+$/ - end + it "has a VERSION" do + Vendorer::VERSION.should =~ /^[\.\da-z]+$/ + end + describe 'version' do it "shows its version via -v" do vendorer('-v').should == "#{Vendorer::VERSION}\n" end it "shows its version via --version" do @@ -60,11 +60,11 @@ it "shows help via --help" do vendorer('--help').should include("Usage") end end - describe '.file' do + describe '#file' do def simple_vendorfile write 'Vendorfile', "file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'" end it "can download a new file" do @@ -150,11 +150,11 @@ vendorer.should_not include(@output) end end end - describe '.folder' do + describe '#folder' do before do write 'Vendorfile', "folder 'its_recursive', '../../.git'" end it "can download from remote" do @@ -187,11 +187,11 @@ write('its_recursive/Gemfile', 'Foo') vendorer read('its_recursive/Gemfile').should == 'Foo' end - describe 'update' do + describe '#update' do it "updates a folder" do vendorer write('its_recursive/Gemfile', 'Foo') vendorer 'update' read('its_recursive/Gemfile').should include('rake') @@ -295,19 +295,28 @@ read('public/javascripts/jquery.js').should include('jQuery') end end end - describe 'rewrite' do + describe '#rewrite' do it "can rewrite a file to change stuff" do write "Vendorfile", " file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js' do |path| rewrite(path){|content| content.gsub('j','h') } end " vendorer content = read('public/javascripts/jquery.min.js')[0..100] content.should_not include('jQuery') content.should include('hQuery') + end + end + + describe "#parse" do + it "executes inside vendorer" do + $test = 1 + v = Vendorer.new + v.parse '$test = self' + $test.should == v end end end