Chris@16: require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') Chris@16: Chris@16: describe "Macros" do Chris@16: fixtures :settings, :repositories, :projects, :enabled_modules Chris@16: Chris@16: include ERB::Util Chris@16: include ApplicationHelper Chris@16: include ActionView::Helpers::TextHelper Chris@16: include ActionView::Helpers::TagHelper Chris@16: include ActionView::Helpers::UrlHelper Chris@16: Chris@16: before(:each) do Chris@16: Setting.checkout_display_command_Subversion = '0' Chris@16: Chris@16: @project = projects :projects_001 Chris@16: end Chris@16: Chris@16: Chris@16: it "should display default checkout url" do Chris@16: text = "{{repository}}" Chris@16: Chris@16: url = "file:///#{RAILS_ROOT.gsub(%r{config\/\.\.}, '')}/tmp/test/subversion_repository" Chris@16: textilizable(text).should eql "

#{url}

" Chris@16: end Chris@16: Chris@16: it "should display forced checkout url" do Chris@16: text = "{{repository(svn+ssh)}}" Chris@16: Chris@16: url = 'svn+ssh://subversion_repository@svn.foo.bar/svn' Chris@16: textilizable(text).should eql "

#{url}

" Chris@16: end Chris@16: Chris@16: it "should fail without set project" do Chris@16: @project = nil Chris@16: Chris@16: text = "{{repository(svn+ssh)}}" Chris@16: textilizable(text).should eql "

Error executing the repository macro (Checkout protocol svn+ssh not found)

" Chris@16: end Chris@16: Chris@16: it "should display checkout url from stated project" do Chris@16: @project = nil Chris@16: text = "{{repository(ecookbook:svn+ssh)}}" Chris@16: Chris@16: url = 'svn+ssh://subversion_repository@svn.foo.bar/svn' Chris@16: textilizable(text).should eql "

#{url}

" Chris@16: end Chris@16: Chris@16: it "should display command" do Chris@16: Setting.checkout_display_command_Subversion = '1' Chris@16: Chris@16: text = "{{repository(svn+ssh)}}" Chris@16: url = 'svn+ssh://subversion_repository@svn.foo.bar/svn' Chris@16: textilizable(text).should eql "

svn co #{url}

" Chris@16: end Chris@16: end