Revision 1297:0a574315af3e .svn/pristine/d6

View differences:

.svn/pristine/d6/d66065a9dcfc99aec6ff539c6e6b8b39441b8dc8.svn-base
1
<%= form_tag(project_enumerations_path(@project), :method => :put, :class => "tabular") do %>
2

  
3
<table class="list">
4
  <thead><tr>
5
    <th><%= l(:field_name) %></th>
6
    <th><%= l(:enumeration_system_activity) %></th>
7
    <% TimeEntryActivity.new.available_custom_fields.each do |value| %>
8
    <th><%= h value.name %></th>
9
    <% end %>
10
    <th style="width:15%;"><%= l(:field_active) %></th>
11
  </tr></thead>
12

  
13
  <% @project.activities(true).each do |enumeration| %>
14
  <%= fields_for "enumerations[#{enumeration.id}]", enumeration do |ff| %>
15
  <tr class="<%= cycle('odd', 'even') %>">
16
    <td>
17
      <%= ff.hidden_field :parent_id, :value => enumeration.id unless enumeration.project %>
18
      <%= h(enumeration) %>
19
    </td>
20
    <td align="center" style="width:15%;"><%= checked_image !enumeration.project %></td>
21
    <% enumeration.custom_field_values.each do |value| %>
22
    <td align="center">
23
      <%= custom_field_tag "enumerations[#{enumeration.id}]", value %>
24
    </td>
25
    <% end %>
26
    <td align="center" style="width:15%;">
27
      <%= ff.check_box :active %>
28
    </td>
29
  </tr>
30
  <% end %>
31
  <% end %>
32
</table>
33

  
34
<div class="contextual">
35
<%= link_to(l(:button_reset), project_enumerations_path(@project),
36
            :method => :delete,
37
            :data => {:confirm => l(:text_are_you_sure)},
38
            :class => 'icon icon-del') %>
39
</div>
40

  
41
<%= submit_tag l(:button_save) %>
42
<% end %>
.svn/pristine/d6/d67c3b233c2de5e381b50b04ecf28037f5dff73a.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  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
require 'sys_controller'
20
require 'mocha'
21

  
22
# Re-raise errors caught by the controller.
23
class SysController; def rescue_action(e) raise e end; end
24

  
25
class SysControllerTest < ActionController::TestCase
26
  fixtures :projects, :repositories, :enabled_modules
27

  
28
  def setup
29
    @controller = SysController.new
30
    @request    = ActionController::TestRequest.new
31
    @response   = ActionController::TestResponse.new
32
    Setting.sys_api_enabled = '1'
33
    Setting.enabled_scm = %w(Subversion Git)
34
  end
35

  
36
  def teardown
37
    Setting.clear_cache
38
  end
39

  
40
  def test_projects_with_repository_enabled
41
    get :projects
42
    assert_response :success
43
    assert_equal 'application/xml', @response.content_type
44
    with_options :tag => 'projects' do |test|
45
      test.assert_tag :children => { :count  => Project.active.has_module(:repository).count }
46
      test.assert_tag 'project', :child => {:tag => 'identifier', :sibling => {:tag => 'is-public'}}
47
    end
48
    assert_no_tag 'extra-info'
49
    assert_no_tag 'extra_info'
50
  end
51

  
52
  def test_create_project_repository
53
    assert_nil Project.find(4).repository
54

  
55
    post :create_project_repository, :id => 4,
56
                                     :vendor => 'Subversion',
57
                                     :repository => { :url => 'file:///create/project/repository/subproject2'}
58
    assert_response :created
59
    assert_equal 'application/xml', @response.content_type
60

  
61
    r = Project.find(4).repository
62
    assert r.is_a?(Repository::Subversion)
63
    assert_equal 'file:///create/project/repository/subproject2', r.url
64
    
65
    assert_tag 'repository-subversion',
66
      :child => {
67
        :tag => 'id', :content => r.id.to_s,
68
        :sibling => {:tag => 'url', :content => r.url}
69
      }
70
    assert_no_tag 'extra-info'
71
    assert_no_tag 'extra_info'
72
  end
73

  
74
  def test_create_already_existing
75
    post :create_project_repository, :id => 1,
76
      :vendor => 'Subversion',
77
      :repository => { :url => 'file:///create/project/repository/subproject2'}
78

  
79
    assert_response :conflict
80
  end
81

  
82
  def test_create_with_failure
83
    post :create_project_repository, :id => 4,
84
      :vendor => 'Subversion',
85
      :repository => { :url => 'invalid url'}
86

  
87
    assert_response :unprocessable_entity
88
  end
89

  
90
  def test_fetch_changesets
91
    Repository::Subversion.any_instance.expects(:fetch_changesets).twice.returns(true)
92
    get :fetch_changesets
93
    assert_response :success
94
  end
95

  
96
  def test_fetch_changesets_one_project_by_identifier
97
    Repository::Subversion.any_instance.expects(:fetch_changesets).once.returns(true)
98
    get :fetch_changesets, :id => 'ecookbook'
99
    assert_response :success
100
  end
101

  
102
  def test_fetch_changesets_one_project_by_id
103
    Repository::Subversion.any_instance.expects(:fetch_changesets).once.returns(true)
104
    get :fetch_changesets, :id => '1'
105
    assert_response :success
106
  end
107

  
108
  def test_fetch_changesets_unknown_project
109
    get :fetch_changesets, :id => 'unknown'
110
    assert_response 404
111
  end
112

  
113
  def test_disabled_ws_should_respond_with_403_error
114
    with_settings :sys_api_enabled => '0' do
115
      get :projects
116
      assert_response 403
117
    end
118
  end
119

  
120
  def test_api_key
121
    with_settings :sys_api_key => 'my_secret_key' do
122
      get :projects, :key => 'my_secret_key'
123
      assert_response :success
124
    end
125
  end
126

  
127
  def test_wrong_key_should_respond_with_403_error
128
    with_settings :sys_api_enabled => 'my_secret_key' do
129
      get :projects, :key => 'wrong_key'
130
      assert_response 403
131
    end
132
  end
133
end
.svn/pristine/d6/d6fa2ab030f2e7ebc86e650e4acc6d8328176458.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  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
namespace :redmine do
19
  namespace :attachments do
20
    desc 'Removes uploaded files left unattached after one day.'
21
    task :prune => :environment do
22
      Attachment.prune
23
    end
24
  end
25

  
26
  namespace :tokens do
27
    desc 'Removes expired tokens.'
28
    task :prune => :environment do
29
      Token.destroy_expired
30
    end
31
  end
32

  
33
  namespace :watchers do
34
    desc 'Removes watchers from what they can no longer view.'
35
    task :prune => :environment do
36
      Watcher.prune
37
    end
38
  end
39

  
40
  desc 'Fetch changesets from the repositories'
41
  task :fetch_changesets => :environment do
42
    Repository.fetch_changesets
43
  end
44

  
45
  desc 'Migrates and copies plugins assets.'
46
  task :plugins do
47
    Rake::Task["redmine:plugins:migrate"].invoke
48
    Rake::Task["redmine:plugins:assets"].invoke
49
  end
50

  
51
  namespace :plugins do
52
    desc 'Migrates installed plugins.'
53
    task :migrate => :environment do
54
      name = ENV['NAME']
55
      version = nil
56
      version_string = ENV['VERSION']
57
      if version_string
58
        if version_string =~ /^\d+$/
59
          version = version_string.to_i
60
          if name.nil?
61
            abort "The VERSION argument requires a plugin NAME."
62
          end
63
        else
64
          abort "Invalid VERSION #{version_string} given."
65
        end
66
      end
67

  
68
      begin
69
        Redmine::Plugin.migrate(name, version)
70
      rescue Redmine::PluginNotFound
71
        abort "Plugin #{name} was not found."
72
      end
73

  
74
      Rake::Task["db:schema:dump"].invoke
75
    end
76

  
77
    desc 'Copies plugins assets into the public directory.'
78
    task :assets => :environment do
79
      name = ENV['NAME']
80

  
81
      begin
82
        Redmine::Plugin.mirror_assets(name)
83
      rescue Redmine::PluginNotFound
84
        abort "Plugin #{name} was not found."
85
      end
86
    end
87

  
88
    desc 'Runs the plugins tests.'
89
    task :test do
90
      Rake::Task["redmine:plugins:test:units"].invoke
91
      Rake::Task["redmine:plugins:test:functionals"].invoke
92
      Rake::Task["redmine:plugins:test:integration"].invoke
93
    end
94

  
95
    namespace :test do
96
      desc 'Runs the plugins unit tests.'
97
      Rake::TestTask.new :units => "db:test:prepare" do |t|
98
        t.libs << "test"
99
        t.verbose = true
100
        t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb"
101
      end
102

  
103
      desc 'Runs the plugins functional tests.'
104
      Rake::TestTask.new :functionals => "db:test:prepare" do |t|
105
        t.libs << "test"
106
        t.verbose = true
107
        t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb"
108
      end
109

  
110
      desc 'Runs the plugins integration tests.'
111
      Rake::TestTask.new :integration => "db:test:prepare" do |t|
112
        t.libs << "test"
113
        t.verbose = true
114
        t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb"
115
      end
116
    end
117
  end
118
end
119

  
120
# Load plugins' rake tasks
121
Dir[File.join(Rails.root, "plugins/*/lib/tasks/**/*.rake")].sort.each { |ext| load ext }

Also available in: Unified diff