comparison plugins/redmine_checkout/spec/macros/macro_spec.rb @ 1484:51364c0cd58f redmine-2.4-integration

Merge from live branch. Still need to merge manually in files overridden by plugins.
author Chris Cannam
date Wed, 15 Jan 2014 09:59:14 +0000
parents b4b72f1eb644
children
comparison
equal deleted inserted replaced
1464:261b3d9a4903 1484:51364c0cd58f
1 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
3 describe "Macros" do
4 fixtures :settings, :repositories, :projects, :enabled_modules
5
6 include ERB::Util
7 include ApplicationHelper
8 include ActionView::Helpers::TextHelper
9 include ActionView::Helpers::TagHelper
10 include ActionView::Helpers::UrlHelper
11
12 before(:each) do
13 Setting.checkout_display_command_Subversion = '0'
14
15 @project = projects :projects_001
16 end
17
18
19 it "should display default checkout url" do
20 text = "{{repository}}"
21
22 url = "file:///#{RAILS_ROOT.gsub(%r{config\/\.\.}, '')}/tmp/test/subversion_repository"
23 textilizable(text).should eql "<p><a href=\"#{url}\">#{url}</a></p>"
24 end
25
26 it "should display forced checkout url" do
27 text = "{{repository(svn+ssh)}}"
28
29 url = 'svn+ssh://subversion_repository@svn.foo.bar/svn'
30 textilizable(text).should eql "<p><a href=\"#{url}\">#{url}</a></p>"
31 end
32
33 it "should fail without set project" do
34 @project = nil
35
36 text = "{{repository(svn+ssh)}}"
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>"
38 end
39
40 it "should display checkout url from stated project" do
41 @project = nil
42 text = "{{repository(ecookbook:svn+ssh)}}"
43
44 url = 'svn+ssh://subversion_repository@svn.foo.bar/svn'
45 textilizable(text).should eql "<p><a href=\"#{url}\">#{url}</a></p>"
46 end
47
48 it "should display command" do
49 Setting.checkout_display_command_Subversion = '1'
50
51 text = "{{repository(svn+ssh)}}"
52 url = 'svn+ssh://subversion_repository@svn.foo.bar/svn'
53 textilizable(text).should eql "<p>svn co <a href=\"#{url}\">#{url}</a></p>"
54 end
55 end