annotate plugins/redmine_checkout/spec/macros/macro_spec.rb @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents b4b72f1eb644
children
rev   line source
Chris@16 1 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
Chris@16 2
Chris@16 3 describe "Macros" do
Chris@16 4 fixtures :settings, :repositories, :projects, :enabled_modules
Chris@16 5
Chris@16 6 include ERB::Util
Chris@16 7 include ApplicationHelper
Chris@16 8 include ActionView::Helpers::TextHelper
Chris@16 9 include ActionView::Helpers::TagHelper
Chris@16 10 include ActionView::Helpers::UrlHelper
Chris@16 11
Chris@16 12 before(:each) do
Chris@16 13 Setting.checkout_display_command_Subversion = '0'
Chris@16 14
Chris@16 15 @project = projects :projects_001
Chris@16 16 end
Chris@16 17
Chris@16 18
Chris@16 19 it "should display default checkout url" do
Chris@16 20 text = "{{repository}}"
Chris@16 21
Chris@16 22 url = "file:///#{RAILS_ROOT.gsub(%r{config\/\.\.}, '')}/tmp/test/subversion_repository"
Chris@16 23 textilizable(text).should eql "<p><a href=\"#{url}\">#{url}</a></p>"
Chris@16 24 end
Chris@16 25
Chris@16 26 it "should display forced checkout url" do
Chris@16 27 text = "{{repository(svn+ssh)}}"
Chris@16 28
Chris@16 29 url = 'svn+ssh://subversion_repository@svn.foo.bar/svn'
Chris@16 30 textilizable(text).should eql "<p><a href=\"#{url}\">#{url}</a></p>"
Chris@16 31 end
Chris@16 32
Chris@16 33 it "should fail without set project" do
Chris@16 34 @project = nil
Chris@16 35
Chris@16 36 text = "{{repository(svn+ssh)}}"
Chris@16 37 textilizable(text).should eql "<p><div class=\"flash error\">Error executing the <strong>repository</strong> macro (Checkout protocol svn+ssh not found)</div></p>"
Chris@16 38 end
Chris@16 39
Chris@16 40 it "should display checkout url from stated project" do
Chris@16 41 @project = nil
Chris@16 42 text = "{{repository(ecookbook:svn+ssh)}}"
Chris@16 43
Chris@16 44 url = 'svn+ssh://subversion_repository@svn.foo.bar/svn'
Chris@16 45 textilizable(text).should eql "<p><a href=\"#{url}\">#{url}</a></p>"
Chris@16 46 end
Chris@16 47
Chris@16 48 it "should display command" do
Chris@16 49 Setting.checkout_display_command_Subversion = '1'
Chris@16 50
Chris@16 51 text = "{{repository(svn+ssh)}}"
Chris@16 52 url = 'svn+ssh://subversion_repository@svn.foo.bar/svn'
Chris@16 53 textilizable(text).should eql "<p>svn co <a href=\"#{url}\">#{url}</a></p>"
Chris@16 54 end
Chris@16 55 end