Revision 1298:4f746d8966dd .svn/pristine/0d

View differences:

.svn/pristine/0d/0d106c8ee2a99b8daf9a6d87887284bdd099fa19.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2011  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require File.expand_path('../../test_helper', __FILE__)
19

  
20
class SettingTest < ActiveSupport::TestCase
21

  
22
  def test_read_default
23
    assert_equal "Redmine", Setting.app_title
24
    assert Setting.self_registration?
25
    assert !Setting.login_required?
26
  end
27

  
28
  def test_update
29
    Setting.app_title = "My title"
30
    assert_equal "My title", Setting.app_title
31
    # make sure db has been updated (INSERT)
32
    assert_equal "My title", Setting.find_by_name('app_title').value
33

  
34
    Setting.app_title = "My other title"
35
    assert_equal "My other title", Setting.app_title
36
    # make sure db has been updated (UPDATE)
37
    assert_equal "My other title", Setting.find_by_name('app_title').value
38
  end
39

  
40
  def test_serialized_setting
41
    Setting.notified_events = ['issue_added', 'issue_updated', 'news_added']
42
    assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.notified_events
43
    assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.find_by_name('notified_events').value
44
  end
45
  
46
  def test_setting_should_be_reloaded_after_clear_cache
47
    Setting.app_title = "My title"
48
    assert_equal "My title", Setting.app_title
49
    
50
    s = Setting.find_by_name("app_title")
51
    s.value = 'New title'
52
    s.save!
53
    assert_equal "My title", Setting.app_title
54
    
55
    Setting.clear_cache
56
    assert_equal "New title", Setting.app_title
57
  end
58
end
.svn/pristine/0d/0d50a39088b6bd107e54b315b0bf77a7ffa63596.svn-base
1
### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake
2

  
3
namespace :test do
4
  desc 'Measures test coverage'
5
  task :coverage do
6
    rm_f "coverage"
7
    rm_f "coverage.data"
8
    rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib --html --exclude gems/"
9
    files = %w(unit functional integration).map {|dir| Dir.glob("test/#{dir}/**/*_test.rb")}.flatten.join(" ")
10
    system("#{rcov} #{files}")
11
  end
12

  
13
  desc 'Run unit and functional scm tests'
14
  task :scm do
15
    errors = %w(test:scm:units test:scm:functionals).collect do |task|
16
      begin
17
        Rake::Task[task].invoke
18
        nil
19
      rescue => e
20
        task
21
      end
22
    end.compact
23
    abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
24
  end
25

  
26
  namespace :scm do
27
    namespace :setup do
28
      desc "Creates directory for test repositories"
29
      task :create_dir do
30
        FileUtils.mkdir_p Rails.root + '/tmp/test'
31
      end
32

  
33
      supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem]
34

  
35
      desc "Creates a test subversion repository"
36
      task :subversion => :create_dir do
37
        repo_path = "tmp/test/subversion_repository"
38
        unless File.exists?(repo_path)
39
          system "svnadmin create #{repo_path}"
40
          system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}"
41
        end
42
      end
43

  
44
      desc "Creates a test mercurial repository"
45
      task :mercurial => :create_dir do
46
        repo_path = "tmp/test/mercurial_repository"
47
        unless File.exists?(repo_path)
48
          bundle_path = "test/fixtures/repositories/mercurial_repository.hg"
49
          system "hg init #{repo_path}"
50
          system "hg -R #{repo_path} pull #{bundle_path}"
51
        end
52
      end
53

  
54
      (supported_scms - [:subversion, :mercurial]).each do |scm|
55
        desc "Creates a test #{scm} repository"
56
        task scm => :create_dir do
57
          unless File.exists?("tmp/test/#{scm}_repository")
58
            # system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test"
59
            system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{scm}_repository.tar.gz"
60
          end
61
        end
62
      end
63

  
64
      desc "Creates all test repositories"
65
      task :all => supported_scms
66
    end
67

  
68
    desc "Updates installed test repositories"
69
    task :update do
70
      require 'fileutils'
71
      Dir.glob("tmp/test/*_repository").each do |dir|
72
        next unless File.basename(dir) =~ %r{^(.+)_repository$} && File.directory?(dir)
73
        scm = $1
74
        next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first
75
        next if File.stat(dir).ctime > File.stat(fixture).mtime
76

  
77
        FileUtils.rm_rf dir
78
        Rake::Task["test:scm:setup:#{scm}"].execute
79
      end
80
    end
81

  
82
    Rake::TestTask.new(:units => "db:test:prepare") do |t|
83
      t.libs << "test"
84
      t.verbose = true
85
      t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb']
86
    end
87
    Rake::Task['test:scm:units'].comment = "Run the scm unit tests"
88

  
89
    Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
90
      t.libs << "test"
91
      t.verbose = true
92
      t.test_files = FileList['test/functional/repositories*_test.rb']
93
    end
94
    Rake::Task['test:scm:functionals'].comment = "Run the scm functional tests"
95
  end
96

  
97
  Rake::TestTask.new(:rdm_routing) do |t|
98
    t.libs << "test"
99
    t.verbose = true
100
    t.test_files = FileList['test/integration/routing/*_test.rb']
101
  end
102
  Rake::Task['test:rdm_routing'].comment = "Run the routing tests"
103

  
104
  Rake::TestTask.new(:ui => "db:test:prepare") do |t|
105
    t.libs << "test"
106
    t.verbose = true
107
    t.test_files = FileList['test/ui/**/*_test.rb']
108
  end
109
  Rake::Task['test:ui'].comment = "Run the UI tests with Capybara (PhantomJS listening on port 4444 is required)"
110
end
.svn/pristine/0d/0d581e597497e894acf26342b5cf129e84f325db.svn-base
1
module Redmine
2
  module Info
3
    class << self
4
      def app_name; 'Redmine' end
5
      def url; 'http://www.redmine.org/' end
6
      def help_url; 'http://www.redmine.org/guide' end
7
      def versioned_name; "#{app_name} #{Redmine::VERSION}" end
8

  
9
      # Creates the url string to a specific Redmine issue
10
      def issue(issue_id)
11
        url + 'issues/' + issue_id.to_s
12
      end
13
    end
14
  end
15
end
.svn/pristine/0d/0d6663388ad2e1df81d9f7719fa0c144a5b76d99.svn-base
1
#!/usr/bin/env ruby
2
require File.expand_path('../../config/boot',  __FILE__)
3
require 'commands/runner'
.svn/pristine/0d/0da01fc24e804fb2e15e93cbb542b0add78e1cbc.svn-base
1
<%= "#{issue.tracker.name} ##{issue.id}: #{issue.subject}" %>
2
<%= issue_url %>
3

  
4
<%=l(:field_author)%>: <%= issue.author %>
5
<%=l(:field_status)%>: <%= issue.status %>
6
<%=l(:field_priority)%>: <%= issue.priority %>
7
<%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
8
<%=l(:field_category)%>: <%= issue.category %>
9
<%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
10
<% issue.custom_field_values.each do |c| %><%= c.custom_field.name %>: <%= show_value(c) %>
11
<% end %>
12

  
13
<%= issue.description %>
.svn/pristine/0d/0dc6f2999aebfb473b433b9a22bddd8917c60616.svn-base
1
# $Id: ldif.rb 78 2006-04-26 02:57:34Z blackhedd $
2
#
3
# Net::LDIF for Ruby
4
#
5
#
6
#
7
# Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
8
#
9
# Gmail: garbagecat10
10
#
11
# This program is free software; you can redistribute it and/or modify
12
# it under the terms of the GNU General Public License as published by
13
# the Free Software Foundation; either version 2 of the License, or
14
# (at your option) any later version.
15
#
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
# GNU General Public License for more details.
20
#
21
# You should have received a copy of the GNU General Public License
22
# along with this program; if not, write to the Free Software
23
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24
#
25
#
26

  
27
# THIS FILE IS A STUB.
28

  
29
module Net
30

  
31
  class LDIF
32

  
33

  
34
  end # class LDIF
35

  
36

  
37
end # module Net
38

  
39

  
.svn/pristine/0d/0de0220c6abf526fd90b0775dd5b7d3c897e479b.svn-base
1
class AddTrackerPosition < ActiveRecord::Migration
2
  def self.up
3
    add_column :trackers, :position, :integer, :default => 1
4
    Tracker.all.each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
5
  end
6

  
7
  def self.down
8
    remove_column :trackers, :position
9
  end
10
end

Also available in: Unified diff