comparison vendor/plugins/redmine_checkout/spec/macros/macro_spec.rb @ 16:020926a36823 yuya

* Add redmine-checkout plugin (as of svn rev 179 of the plugin)
author Chris Cannam
date Wed, 25 Aug 2010 16:39:01 +0100
parents
children
comparison
equal deleted inserted replaced
15:9c6c72729d91 16:020926a36823
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