@@ -1,6 +1,6 | |||
|
1 | 1 | source 'https://rubygems.org' |
|
2 | 2 | |
|
3 |
gem "rails", "4. |
|
|
3 | gem "rails", "4.2.0" | |
|
4 | 4 | gem "jquery-rails", "~> 3.1.1" |
|
5 | 5 | gem "coderay", "~> 1.1.0" |
|
6 | 6 | gem "builder", ">= 3.0.4" |
@@ -86,7 +86,8 end | |||
|
86 | 86 | |
|
87 | 87 | group :test do |
|
88 | 88 | gem "minitest" |
|
89 | gem "mocha", "~> 1.0.0", :require => 'mocha/api' | |
|
89 | gem "rails-dom-testing" | |
|
90 | gem "mocha", "~> 1.0.0" | |
|
90 | 91 | gem "simplecov", "~> 0.9.1", :require => false |
|
91 | 92 | # For running UI tests |
|
92 | 93 | gem "capybara" |
@@ -80,7 +80,7 module ApplicationHelper | |||
|
80 | 80 | end |
|
81 | 81 | end |
|
82 | 82 | only_path = options[:only_path].nil? ? true : options[:only_path] |
|
83 |
s = link_to(text, issue_ |
|
|
83 | s = link_to(text, issue_url(issue, :only_path => only_path), | |
|
84 | 84 | :class => issue.css_classes, :title => title) |
|
85 | 85 | s << h(": #{subject}") if subject |
|
86 | 86 | s = h("#{issue.project} - ") + s if options[:project] |
@@ -93,8 +93,9 module ApplicationHelper | |||
|
93 | 93 | # * :download - Force download (default: false) |
|
94 | 94 | def link_to_attachment(attachment, options={}) |
|
95 | 95 | text = options.delete(:text) || attachment.filename |
|
96 |
route_method = options.delete(:download) ? :download_named_attachment_ |
|
|
96 | route_method = options.delete(:download) ? :download_named_attachment_url : :named_attachment_url | |
|
97 | 97 | html_options = options.slice!(:only_path) |
|
98 | options[:only_path] = true unless options.key?(:only_path) | |
|
98 | 99 | url = send(route_method, attachment, attachment.filename, options) |
|
99 | 100 | link_to text, url, html_options |
|
100 | 101 | end |
@@ -120,9 +121,10 module ApplicationHelper | |||
|
120 | 121 | def link_to_message(message, options={}, html_options = nil) |
|
121 | 122 | link_to( |
|
122 | 123 | message.subject.truncate(60), |
|
123 |
board_message_ |
|
|
124 | board_message_url(message.board_id, message.parent_id || message.id, { | |
|
124 | 125 | :r => (message.parent_id && message.id), |
|
125 | :anchor => (message.parent_id ? "message-#{message.id}" : nil) | |
|
126 | :anchor => (message.parent_id ? "message-#{message.id}" : nil), | |
|
127 | :only_path => true | |
|
126 | 128 | }.merge(options)), |
|
127 | 129 | html_options |
|
128 | 130 | ) |
@@ -139,7 +141,9 module ApplicationHelper | |||
|
139 | 141 | if project.archived? |
|
140 | 142 | h(project.name) |
|
141 | 143 | else |
|
142 | link_to project.name, project_path(project, options), html_options | |
|
144 | link_to project.name, | |
|
145 | project_url(project, {:only_path => true}.merge(options)), | |
|
146 | html_options | |
|
143 | 147 | end |
|
144 | 148 | end |
|
145 | 149 | |
@@ -626,7 +630,7 module ApplicationHelper | |||
|
626 | 630 | filename, ext, alt, alttext = $1.downcase, $2, $3, $4 |
|
627 | 631 | # search for the picture in attachments |
|
628 | 632 | if found = Attachment.latest_attach(attachments, filename) |
|
629 |
image_url = download_named_attachment_ |
|
|
633 | image_url = download_named_attachment_url(found, found.filename, :only_path => only_path) | |
|
630 | 634 | desc = found.description.to_s.gsub('"', '') |
|
631 | 635 | if !desc.blank? && alttext.blank? |
|
632 | 636 | alt = " title=\"#{desc}\" alt=\"#{desc}\"" |
@@ -769,17 +773,17 module ApplicationHelper | |||
|
769 | 773 | issue = Issue.visible.find_by_id(oid) |
|
770 | 774 | anchor = comment_id ? "note-#{comment_id}" : nil |
|
771 | 775 | link = link_to("##{oid}#{comment_suffix}", |
|
772 |
issue_ |
|
|
776 | issue_url(issue, :only_path => only_path, :anchor => anchor), | |
|
773 | 777 | :class => issue.css_classes, |
|
774 | 778 | :title => "#{issue.subject.truncate(100)} (#{issue.status.name})") |
|
775 | 779 | end |
|
776 | 780 | when 'document' |
|
777 | 781 | if document = Document.visible.find_by_id(oid) |
|
778 |
link = link_to(document.title, document_ |
|
|
782 | link = link_to(document.title, document_url(document, :only_path => only_path), :class => 'document') | |
|
779 | 783 | end |
|
780 | 784 | when 'version' |
|
781 | 785 | if version = Version.visible.find_by_id(oid) |
|
782 |
link = link_to(version.name, version_ |
|
|
786 | link = link_to(version.name, version_url(version, :only_path => only_path), :class => 'version') | |
|
783 | 787 | end |
|
784 | 788 | when 'message' |
|
785 | 789 | if message = Message.visible.find_by_id(oid) |
@@ -787,11 +791,11 module ApplicationHelper | |||
|
787 | 791 | end |
|
788 | 792 | when 'forum' |
|
789 | 793 | if board = Board.visible.find_by_id(oid) |
|
790 |
link = link_to(board.name, project_board_ |
|
|
794 | link = link_to(board.name, project_board_url(board.project, board, :only_path => only_path), :class => 'board') | |
|
791 | 795 | end |
|
792 | 796 | when 'news' |
|
793 | 797 | if news = News.visible.find_by_id(oid) |
|
794 |
link = link_to(news.title, news_ |
|
|
798 | link = link_to(news.title, news_url(news, :only_path => only_path), :class => 'news') | |
|
795 | 799 | end |
|
796 | 800 | when 'project' |
|
797 | 801 | if p = Project.visible.find_by_id(oid) |
@@ -805,19 +809,19 module ApplicationHelper | |||
|
805 | 809 | case prefix |
|
806 | 810 | when 'document' |
|
807 | 811 | if project && document = project.documents.visible.find_by_title(name) |
|
808 |
link = link_to(document.title, document_ |
|
|
812 | link = link_to(document.title, document_url(document, :only_path => only_path), :class => 'document') | |
|
809 | 813 | end |
|
810 | 814 | when 'version' |
|
811 | 815 | if project && version = project.versions.visible.find_by_name(name) |
|
812 |
link = link_to(version.name, version_ |
|
|
816 | link = link_to(version.name, version_url(version, :only_path => only_path), :class => 'version') | |
|
813 | 817 | end |
|
814 | 818 | when 'forum' |
|
815 | 819 | if project && board = project.boards.visible.find_by_name(name) |
|
816 |
link = link_to(board.name, project_board_ |
|
|
820 | link = link_to(board.name, project_board_url(board.project, board, :only_path => only_path), :class => 'board') | |
|
817 | 821 | end |
|
818 | 822 | when 'news' |
|
819 | 823 | if project && news = project.news.visible.find_by_title(name) |
|
820 |
link = link_to(news.title, news_ |
|
|
824 | link = link_to(news.title, news_url(news, :only_path => only_path), :class => 'news') | |
|
821 | 825 | end |
|
822 | 826 | when 'commit', 'source', 'export' |
|
823 | 827 | if project |
@@ -76,8 +76,7 class Issue < ActiveRecord::Base | |||
|
76 | 76 | attr_protected :id |
|
77 | 77 | |
|
78 | 78 | scope :visible, lambda {|*args| |
|
79 |
in |
|
|
80 | references(:project). | |
|
79 | joins(:project). | |
|
81 | 80 | where(Issue.visible_condition(args.shift || User.current, *args)) |
|
82 | 81 | } |
|
83 | 82 |
@@ -17,7 +17,6 | |||
|
17 | 17 | |
|
18 | 18 | class JournalDetail < ActiveRecord::Base |
|
19 | 19 | belongs_to :journal |
|
20 | before_save :normalize_values | |
|
21 | 20 | attr_protected :id |
|
22 | 21 | |
|
23 | 22 | def custom_field |
@@ -26,13 +25,16 class JournalDetail < ActiveRecord::Base | |||
|
26 | 25 | end |
|
27 | 26 | end |
|
28 | 27 | |
|
29 | private | |
|
28 | def value=(arg) | |
|
29 | write_attribute :value, normalize(arg) | |
|
30 | end | |
|
30 | 31 | |
|
31 |
def |
|
|
32 |
|
|
|
33 | self.old_value = normalize(old_value) | |
|
32 | def old_value=(arg) | |
|
33 | write_attribute :old_value, normalize(arg) | |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | private | |
|
37 | ||
|
36 | 38 | def normalize(v) |
|
37 | 39 | case v |
|
38 | 40 | when true |
@@ -46,7 +46,7 | |||
|
46 | 46 | <td class="last_login_on"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td> |
|
47 | 47 | <td class="buttons"> |
|
48 | 48 | <%= change_status_link(user) %> |
|
49 |
<%= delete_link user_path(user, :back_url => |
|
|
49 | <%= delete_link user_path(user, :back_url => request.original_fullpath) unless User.current == user %> | |
|
50 | 50 | </td> |
|
51 | 51 | </tr> |
|
52 | 52 | <% end -%> |
@@ -29,5 +29,7 Rails.application.configure do | |||
|
29 | 29 | # Print deprecation notices to stderr and the Rails logger. |
|
30 | 30 | config.active_support.deprecation = [:stderr, :log] |
|
31 | 31 | |
|
32 |
config.secret_ |
|
|
32 | config.secret_key_base = 'a secret token for running the tests' | |
|
33 | ||
|
34 | config.active_support.test_order = :random | |
|
33 | 35 | end |
@@ -146,6 +146,16 module ActionMailer | |||
|
146 | 146 | end |
|
147 | 147 | end |
|
148 | 148 | |
|
149 | # #deliver is deprecated in Rails 4.2 | |
|
150 | # Prevents massive deprecation warnings | |
|
151 | module ActionMailer | |
|
152 | class MessageDelivery < Delegator | |
|
153 | def deliver | |
|
154 | deliver_now | |
|
155 | end | |
|
156 | end | |
|
157 | end | |
|
158 | ||
|
149 | 159 | module ActionController |
|
150 | 160 | module MimeResponds |
|
151 | 161 | class Collector |
@@ -163,32 +173,8 module ActionController | |||
|
163 | 173 | # TODO: remove it in a later version |
|
164 | 174 | def self.session=(*args) |
|
165 | 175 | $stderr.puts "Please remove config/initializers/session_store.rb and run `rake generate_secret_token`.\n" + |
|
166 |
"Setting the session secret with ActionController.session= is no longer supported |
|
|
176 | "Setting the session secret with ActionController.session= is no longer supported." | |
|
167 | 177 | exit 1 |
|
168 | 178 | end |
|
169 | 179 | end |
|
170 | 180 | end |
|
171 | ||
|
172 | if Rails::VERSION::MAJOR < 4 && RUBY_VERSION >= "2.1" | |
|
173 | module ActiveSupport | |
|
174 | class HashWithIndifferentAccess | |
|
175 | def select(*args, &block) | |
|
176 | dup.tap { |hash| hash.select!(*args, &block) } | |
|
177 | end | |
|
178 | ||
|
179 | def reject(*args, &block) | |
|
180 | dup.tap { |hash| hash.reject!(*args, &block) } | |
|
181 | end | |
|
182 | end | |
|
183 | ||
|
184 | class OrderedHash | |
|
185 | def select(*args, &block) | |
|
186 | dup.tap { |hash| hash.select!(*args, &block) } | |
|
187 | end | |
|
188 | ||
|
189 | def reject(*args, &block) | |
|
190 | dup.tap { |hash| hash.reject!(*args, &block) } | |
|
191 | end | |
|
192 | end | |
|
193 | end | |
|
194 | end |
@@ -217,15 +217,16 Rails.application.routes.draw do | |||
|
217 | 217 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' |
|
218 | 218 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' |
|
219 | 219 | |
|
220 |
get 'projects/:id/repository/:repository_id/changes(/*path |
|
|
221 | :to => 'repositories#changes' | |
|
220 | get 'projects/:id/repository/:repository_id/changes(/*path)', | |
|
221 | :to => 'repositories#changes', | |
|
222 | :format => false | |
|
222 | 223 | |
|
223 | 224 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' |
|
224 | 225 | get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' |
|
225 | 226 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
226 | 227 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
227 | 228 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' |
|
228 |
get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path |
|
|
229 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path)', | |
|
229 | 230 | :controller => 'repositories', |
|
230 | 231 | :format => false, |
|
231 | 232 | :constraints => { |
@@ -236,27 +237,30 Rails.application.routes.draw do | |||
|
236 | 237 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' |
|
237 | 238 | get 'projects/:id/repository/graph', :to => 'repositories#graph' |
|
238 | 239 | |
|
239 |
get 'projects/:id/repository/changes(/*path |
|
|
240 | :to => 'repositories#changes' | |
|
240 | get 'projects/:id/repository/changes(/*path)', | |
|
241 | :to => 'repositories#changes', | |
|
242 | :format => false | |
|
241 | 243 | |
|
242 | 244 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' |
|
243 | 245 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' |
|
244 | 246 | get 'projects/:id/repository/revision', :to => 'repositories#revision' |
|
245 | 247 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
246 | 248 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
247 |
get 'projects/:id/repository/revisions/:rev/:action(/*path |
|
|
249 | get 'projects/:id/repository/revisions/:rev/:action(/*path)', | |
|
248 | 250 | :controller => 'repositories', |
|
249 | 251 | :format => false, |
|
250 | 252 | :constraints => { |
|
251 | 253 | :action => /(browse|show|entry|raw|annotate|diff)/, |
|
252 | 254 | :rev => /[a-z0-9\.\-_]+/ |
|
253 | 255 | } |
|
254 |
get 'projects/:id/repository/:repository_id/:action(/*path |
|
|
256 | get 'projects/:id/repository/:repository_id/:action(/*path)', | |
|
255 | 257 | :controller => 'repositories', |
|
256 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ | |
|
257 | get 'projects/:id/repository/:action(/*path(.:ext))', | |
|
258 | :action => /(browse|show|entry|raw|changes|annotate|diff)/, | |
|
259 | :format => false | |
|
260 | get 'projects/:id/repository/:action(/*path)', | |
|
258 | 261 | :controller => 'repositories', |
|
259 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ | |
|
262 | :action => /(browse|show|entry|raw|changes|annotate|diff)/, | |
|
263 | :format => false | |
|
260 | 264 | |
|
261 | 265 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil |
|
262 | 266 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil |
@@ -15,7 +15,7 file 'config/initializers/secret_token.rb' do | |||
|
15 | 15 | # change this key, all old sessions will become invalid! Make sure the |
|
16 | 16 | # secret is at least 30 characters and all random, no regular words or |
|
17 | 17 | # you'll be exposed to dictionary attacks. |
|
18 |
RedmineApp::Application.config.secret_ |
|
|
18 | RedmineApp::Application.config.secret_key_base = '#{secret}' | |
|
19 | 19 | EOF |
|
20 | 20 | end |
|
21 | 21 | end |
@@ -104,7 +104,7 namespace :test do | |||
|
104 | 104 | Rake::TestTask.new(:ui => "db:test:prepare") do |t| |
|
105 | 105 | t.libs << "test" |
|
106 | 106 | t.verbose = true |
|
107 | t.test_files = FileList['test/ui/**/*_test.rb'] | |
|
107 | t.test_files = FileList['test/ui/**/*_test_ui.rb'] | |
|
108 | 108 | end |
|
109 | 109 | Rake::Task['test:ui'].comment = "Run the UI tests with Capybara (PhantomJS listening on port 4444 is required)" |
|
110 | 110 | end |
|
1 | NO CONTENT: file renamed from test/extra/redmine_pm/repository_git_test.rb to test/extra/redmine_pm/repository_git_test_pm.rb |
|
1 | NO CONTENT: file renamed from test/extra/redmine_pm/repository_subversion_test.rb to test/extra/redmine_pm/repository_subversion_test_pm.rb |
@@ -118,8 +118,8 class ActivitiesControllerTest < ActionController::TestCase | |||
|
118 | 118 | assert_template 'common/feed' |
|
119 | 119 | |
|
120 | 120 | assert_select 'feed' do |
|
121 |
assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1& |
|
|
122 |
assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1& |
|
|
121 | assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0' | |
|
122 | assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0' | |
|
123 | 123 | assert_select 'entry' do |
|
124 | 124 | assert_select 'link[href=?]', 'http://test.host/issues/11' |
|
125 | 125 | end |
@@ -94,7 +94,7 class AuthSourcesControllerTest < ActionController::TestCase | |||
|
94 | 94 | get :edit, :id => 1 |
|
95 | 95 | assert_response :success |
|
96 | 96 | assert_select 'input[value=secret]', 0 |
|
97 |
assert_select 'input[name=dummy_password][value |
|
|
97 | assert_select 'input[name=dummy_password][value^=xxxxxx]' | |
|
98 | 98 | end |
|
99 | 99 | |
|
100 | 100 | def test_edit_invalid_should_respond_with_404 |
@@ -117,9 +117,13 class BoardsControllerTest < ActionController::TestCase | |||
|
117 | 117 | |
|
118 | 118 | assert_select 'select[name=?]', 'board[parent_id]' do |
|
119 | 119 | assert_select 'option', (Project.find(1).boards.size + 1) |
|
120 |
assert_select 'option[value=""]' |
|
|
120 | assert_select 'option[value=""]' | |
|
121 | 121 | assert_select 'option[value="1"]', :text => 'Help' |
|
122 | 122 | end |
|
123 | ||
|
124 | # replaced by nokogiri, not easy to test in DOM assertions | |
|
125 | assert_not_include '<option value=""></option>', response.body | |
|
126 | assert_include '<option value=""> </option>', response.body | |
|
123 | 127 | end |
|
124 | 128 | |
|
125 | 129 | def test_new_without_project_boards |
@@ -44,15 +44,15 class ContextMenusControllerTest < ActionController::TestCase | |||
|
44 | 44 | assert_select 'a.icon-del[href=?]', '/issues?ids%5B%5D=1', :text => 'Delete' |
|
45 | 45 | |
|
46 | 46 | # Statuses |
|
47 |
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1& |
|
|
48 |
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1& |
|
|
47 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bstatus_id%5D=5', :text => 'Closed' | |
|
48 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bpriority_id%5D=8', :text => 'Immediate' | |
|
49 | 49 | # No inactive priorities |
|
50 | 50 | assert_select 'a', :text => /Inactive Priority/, :count => 0 |
|
51 | 51 | # Versions |
|
52 |
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1& |
|
|
53 |
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1& |
|
|
52 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3', :text => '2.0' | |
|
53 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0' | |
|
54 | 54 | # Assignees |
|
55 |
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1& |
|
|
55 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper' | |
|
56 | 56 | end |
|
57 | 57 | |
|
58 | 58 | def test_context_menu_one_issue_by_anonymous |
@@ -72,15 +72,15 class ContextMenusControllerTest < ActionController::TestCase | |||
|
72 | 72 | assert_not_nil assigns(:issues) |
|
73 | 73 | assert_equal [1, 2], assigns(:issues).map(&:id).sort |
|
74 | 74 | |
|
75 |
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('& |
|
|
75 | ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&') | |
|
76 | 76 | |
|
77 | 77 | assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit' |
|
78 |
assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1& |
|
|
78 | assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1&#{ids}", :text => 'Copy' | |
|
79 | 79 | assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete' |
|
80 | 80 | |
|
81 |
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}& |
|
|
82 |
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}& |
|
|
83 |
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}& |
|
|
81 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed' | |
|
82 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate' | |
|
83 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=3", :text => 'Dave Lopper' | |
|
84 | 84 | end |
|
85 | 85 | |
|
86 | 86 | def test_context_menu_multiple_issues_of_different_projects |
@@ -91,14 +91,14 class ContextMenusControllerTest < ActionController::TestCase | |||
|
91 | 91 | assert_not_nil assigns(:issues) |
|
92 | 92 | assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort |
|
93 | 93 | |
|
94 |
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('& |
|
|
94 | ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&') | |
|
95 | 95 | |
|
96 | 96 | assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit' |
|
97 | 97 | assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete' |
|
98 | 98 | |
|
99 |
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}& |
|
|
100 |
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}& |
|
|
101 |
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}& |
|
|
99 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed' | |
|
100 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate' | |
|
101 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=2", :text => 'John Smith' | |
|
102 | 102 | end |
|
103 | 103 | |
|
104 | 104 | def test_context_menu_should_include_list_custom_fields |
@@ -108,11 +108,11 class ContextMenusControllerTest < ActionController::TestCase | |||
|
108 | 108 | get :issues, :ids => [1] |
|
109 | 109 | |
|
110 | 110 | assert_select "li.cf_#{field.id}" do |
|
111 | assert_select 'a[href=#]', :text => 'List' | |
|
111 | assert_select 'a[href="#"]', :text => 'List' | |
|
112 | 112 | assert_select 'ul' do |
|
113 | 113 | assert_select 'a', 3 |
|
114 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
115 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
114 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo' | |
|
115 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none' | |
|
116 | 116 | end |
|
117 | 117 | end |
|
118 | 118 | end |
@@ -124,7 +124,7 class ContextMenusControllerTest < ActionController::TestCase | |||
|
124 | 124 | get :issues, :ids => [1, 2] |
|
125 | 125 | |
|
126 | 126 | assert_select "li.cf_#{field.id}" do |
|
127 | assert_select 'a[href=#]', :text => 'List' | |
|
127 | assert_select 'a[href="#"]', :text => 'List' | |
|
128 | 128 | assert_select 'ul' do |
|
129 | 129 | assert_select 'a', 2 |
|
130 | 130 | assert_select 'a', :text => 'none', :count => 0 |
@@ -142,7 +142,7 class ContextMenusControllerTest < ActionController::TestCase | |||
|
142 | 142 | get :issues, :ids => [1] |
|
143 | 143 | |
|
144 | 144 | assert_select "li.cf_#{field.id}" do |
|
145 | assert_select 'a[href=#]', :text => 'List' | |
|
145 | assert_select 'a[href="#"]', :text => 'List' | |
|
146 | 146 | assert_select 'ul' do |
|
147 | 147 | assert_select 'a', 3 |
|
148 | 148 | assert_select 'a.icon-checked', :text => 'Bar' |
@@ -157,12 +157,12 class ContextMenusControllerTest < ActionController::TestCase | |||
|
157 | 157 | get :issues, :ids => [1] |
|
158 | 158 | |
|
159 | 159 | assert_select "li.cf_#{field.id}" do |
|
160 | assert_select 'a[href=#]', :text => 'Bool' | |
|
160 | assert_select 'a[href="#"]', :text => 'Bool' | |
|
161 | 161 | assert_select 'ul' do |
|
162 | 162 | assert_select 'a', 3 |
|
163 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
164 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
165 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
163 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No' | |
|
164 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes' | |
|
165 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none' | |
|
166 | 166 | end |
|
167 | 167 | end |
|
168 | 168 | end |
@@ -174,11 +174,11 class ContextMenusControllerTest < ActionController::TestCase | |||
|
174 | 174 | get :issues, :ids => [1] |
|
175 | 175 | |
|
176 | 176 | assert_select "li.cf_#{field.id}" do |
|
177 | assert_select 'a[href=#]', :text => 'User' | |
|
177 | assert_select 'a[href="#"]', :text => 'User' | |
|
178 | 178 | assert_select 'ul' do |
|
179 | 179 | assert_select 'a', Project.find(1).members.count + 1 |
|
180 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
181 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
180 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith' | |
|
181 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none' | |
|
182 | 182 | end |
|
183 | 183 | end |
|
184 | 184 | end |
@@ -189,11 +189,11 class ContextMenusControllerTest < ActionController::TestCase | |||
|
189 | 189 | get :issues, :ids => [1] |
|
190 | 190 | |
|
191 | 191 | assert_select "li.cf_#{field.id}" do |
|
192 | assert_select 'a[href=#]', :text => 'Version' | |
|
192 | assert_select 'a[href="#"]', :text => 'Version' | |
|
193 | 193 | assert_select 'ul' do |
|
194 | 194 | assert_select 'a', Project.find(1).shared_versions.count + 1 |
|
195 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
196 |
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1& |
|
|
195 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0' | |
|
196 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none' | |
|
197 | 197 | end |
|
198 | 198 | end |
|
199 | 199 | end |
@@ -216,7 +216,7 class ContextMenusControllerTest < ActionController::TestCase | |||
|
216 | 216 | assert_response :success |
|
217 | 217 | assert_template 'context_menus/issues' |
|
218 | 218 | |
|
219 |
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1& |
|
|
219 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2', :text => / me / | |
|
220 | 220 | end |
|
221 | 221 | |
|
222 | 222 | def test_context_menu_should_propose_shared_versions_for_issues_from_different_projects |
@@ -266,12 +266,12 class ContextMenusControllerTest < ActionController::TestCase | |||
|
266 | 266 | get :time_entries, :ids => [1, 2] |
|
267 | 267 | assert_response :success |
|
268 | 268 | assert_select "li.cf_#{field.id}" do |
|
269 | assert_select 'a[href=#]', :text => "Field" | |
|
269 | assert_select 'a[href="#"]', :text => "Field" | |
|
270 | 270 | assert_select 'ul' do |
|
271 | 271 | assert_select 'a', 3 |
|
272 |
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1& |
|
|
273 |
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1& |
|
|
274 |
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1& |
|
|
272 | assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&ids%5B%5D=2&time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=foo", :text => 'foo' | |
|
273 | assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&ids%5B%5D=2&time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=bar", :text => 'bar' | |
|
274 | assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&ids%5B%5D=2&time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none' | |
|
275 | 275 | end |
|
276 | 276 | end |
|
277 | 277 | end |
@@ -371,7 +371,7 class IssuesControllerTest < ActionController::TestCase | |||
|
371 | 371 | assert_select 'a.atom[href="/issues.atom"]' |
|
372 | 372 | assert_select 'a.csv[href="/issues.csv"]' |
|
373 | 373 | assert_select 'a.pdf[href="/issues.pdf"]' |
|
374 | assert_select 'form#csv-export-form[action=/issues.csv]' | |
|
374 | assert_select 'form#csv-export-form[action="/issues.csv"]' | |
|
375 | 375 | end |
|
376 | 376 | |
|
377 | 377 | def test_index_should_not_warn_when_not_exceeding_export_limit |
@@ -861,7 +861,7 class IssuesControllerTest < ActionController::TestCase | |||
|
861 | 861 | get :index, :set_filter => 1, :c => %w(subject description) |
|
862 | 862 | |
|
863 | 863 | assert_select 'table.issues thead th', 3 # columns: chekbox + id + subject |
|
864 | assert_select 'td.description[colspan=3]', :text => 'Unable to print recipes' | |
|
864 | assert_select 'td.description[colspan="3"]', :text => 'Unable to print recipes' | |
|
865 | 865 | |
|
866 | 866 | get :index, :set_filter => 1, :c => %w(subject description), :format => 'pdf' |
|
867 | 867 | assert_response :success |
@@ -1012,7 +1012,7 class IssuesControllerTest < ActionController::TestCase | |||
|
1012 | 1012 | @request.session[:user_id] = 2 |
|
1013 | 1013 | get :show, :id => 1 |
|
1014 | 1014 | |
|
1015 | assert_select 'form#issue-form[method=post][enctype=multipart/form-data]' do | |
|
1015 | assert_select 'form#issue-form[method=post][enctype="multipart/form-data"]' do | |
|
1016 | 1016 | assert_select 'input[type=file][name=?]', 'attachments[dummy][file]' |
|
1017 | 1017 | end |
|
1018 | 1018 | end |
@@ -1622,7 +1622,7 class IssuesControllerTest < ActionController::TestCase | |||
|
1622 | 1622 | @request.session[:user_id] = 2 |
|
1623 | 1623 | get :new, :project_id => 1, :tracker_id => 1 |
|
1624 | 1624 | |
|
1625 | assert_select 'form[id=issue-form][method=post][enctype=multipart/form-data]' do | |
|
1625 | assert_select 'form[id=issue-form][method=post][enctype="multipart/form-data"]' do | |
|
1626 | 1626 | assert_select 'input[name=?][type=file]', 'attachments[dummy][file]' |
|
1627 | 1627 | end |
|
1628 | 1628 | end |
@@ -2429,7 +2429,7 class IssuesControllerTest < ActionController::TestCase | |||
|
2429 | 2429 | assert_equal orig.subject, assigns(:issue).subject |
|
2430 | 2430 | assert assigns(:issue).copy? |
|
2431 | 2431 | |
|
2432 | assert_select 'form[id=issue-form][action=/projects/ecookbook/issues]' do | |
|
2432 | assert_select 'form[id=issue-form][action="/projects/ecookbook/issues"]' do | |
|
2433 | 2433 | assert_select 'select[name=?]', 'issue[project_id]' do |
|
2434 | 2434 | assert_select 'option[value="1"][selected=selected]', :text => 'eCookbook' |
|
2435 | 2435 | assert_select 'option[value="2"]:not([selected])', :text => 'OnlineStore' |
@@ -2629,7 +2629,7 class IssuesControllerTest < ActionController::TestCase | |||
|
2629 | 2629 | assert_not_nil assigns(:issue) |
|
2630 | 2630 | assert assigns(:issue).copy? |
|
2631 | 2631 | |
|
2632 | assert_select 'form#issue-form[action=/projects/ecookbook/issues]' do | |
|
2632 | assert_select 'form#issue-form[action="/projects/ecookbook/issues"]' do | |
|
2633 | 2633 | assert_select 'select[name=?]', 'issue[project_id]' do |
|
2634 | 2634 | assert_select 'option[value="1"]:not([selected])', :text => 'eCookbook' |
|
2635 | 2635 | assert_select 'option[value="2"][selected=selected]', :text => 'OnlineStore' |
@@ -2701,7 +2701,7 class IssuesControllerTest < ActionController::TestCase | |||
|
2701 | 2701 | assert_select 'option[value="7"][selected=selected]', :text => 'Urgent' |
|
2702 | 2702 | end |
|
2703 | 2703 | |
|
2704 | assert_select 'input[name=?][value=2.5]', 'time_entry[hours]' | |
|
2704 | assert_select 'input[name=?][value="2.5"]', 'time_entry[hours]' | |
|
2705 | 2705 | assert_select 'select[name=?]', 'time_entry[activity_id]' do |
|
2706 | 2706 | assert_select 'option[value="10"][selected=selected]', :text => 'Development' |
|
2707 | 2707 | end |
@@ -245,7 +245,7 class IssuesControllerTransactionTest < ActionController::TestCase | |||
|
245 | 245 | assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2.5' |
|
246 | 246 | assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'should not be added' |
|
247 | 247 | assert_select 'select[name=?]', 'time_entry[activity_id]' do |
|
248 | assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id | |
|
248 | assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id.to_s | |
|
249 | 249 | end |
|
250 | 250 | end |
|
251 | 251 |
@@ -83,9 +83,9 class IssuesCustomFieldsVisibilityTest < ActionController::TestCase | |||
|
83 | 83 | end |
|
84 | 84 | @fields.each_with_index do |field, i| |
|
85 | 85 | if fields.include?(field) |
|
86 |
assert_select "custom_field[id= |
|
|
86 | assert_select "custom_field[id=?] value", field.id.to_s, {:text => "Value#{i}", :count => 1}, "User #{user.id} was not able to view #{field.name} in API" | |
|
87 | 87 | else |
|
88 |
assert_select "custom_field[id= |
|
|
88 | assert_select "custom_field[id=?] value", field.id.to_s, {:text => "Value#{i}", :count => 0}, "User #{user.id} was not able to view #{field.name} in API" | |
|
89 | 89 | end |
|
90 | 90 | end |
|
91 | 91 | end |
@@ -126,7 +126,7 class MyControllerTest < ActionController::TestCase | |||
|
126 | 126 | get :destroy |
|
127 | 127 | assert_response :success |
|
128 | 128 | assert_template 'destroy' |
|
129 | assert_select 'form[action=/my/account/destroy]' do | |
|
129 | assert_select 'form[action="/my/account/destroy"]' do | |
|
130 | 130 | assert_select 'input[name=confirm]' |
|
131 | 131 | end |
|
132 | 132 | end |
@@ -123,7 +123,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
123 | 123 | assert_response :success |
|
124 | 124 | assert_template 'diff' |
|
125 | 125 | # Line 11 removed |
|
126 |
assert_select 'th.line-num:cont |
|
|
126 | assert_select 'th.line-num:contains(11) ~ td.diff_out', :text => /Display more information/ | |
|
127 | 127 | end |
|
128 | 128 | end |
|
129 | 129 | |
@@ -157,7 +157,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
157 | 157 | assert_select "th.line-num", :text => '1' do |
|
158 | 158 | assert_select "+ td.revision" do |
|
159 | 159 | assert_select "a", :text => '2' |
|
160 |
assert_select "+ td.author", :text => "test & |
|
|
160 | assert_select "+ td.author", :text => "test &" do | |
|
161 | 161 | assert_select "+ td", |
|
162 | 162 | :text => "author escaping test" |
|
163 | 163 | end |
@@ -275,14 +275,8 class RepositoriesControllerTest < ActionController::TestCase | |||
|
275 | 275 | assert_response :success |
|
276 | 276 | assert_template 'committers' |
|
277 | 277 | |
|
278 | assert_select 'td:content(dlopper) + td select' do | |
|
279 | assert_select 'option[value="3"][selected=selected]', :text => 'Dave Lopper' | |
|
280 | end | |
|
281 | ||
|
282 | assert_select 'td:content(foo) + td select' do | |
|
283 | assert_select 'option[value=""]' | |
|
284 | assert_select 'option[selected=selected]', 0 # no option selected | |
|
285 | end | |
|
278 | assert_select 'input[value=dlopper] + select option[value="3"][selected=selected]', :text => 'Dave Lopper' | |
|
279 | assert_select 'input[value=foo] + select option[selected=selected]', 0 # no option selected | |
|
286 | 280 | end |
|
287 | 281 | |
|
288 | 282 | def test_post_committers |
@@ -116,7 +116,7 class RepositoriesDarcsControllerTest < ActionController::TestCase | |||
|
116 | 116 | assert_response :success |
|
117 | 117 | assert_template 'diff' |
|
118 | 118 | # Line 22 removed |
|
119 |
assert_select 'th.line-num:cont |
|
|
119 | assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |
|
120 | 120 | end |
|
121 | 121 | end |
|
122 | 122 |
@@ -265,7 +265,7 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
265 | 265 | assert_response :success |
|
266 | 266 | assert_template 'diff' |
|
267 | 267 | # Line 22 removed |
|
268 |
assert_select 'th.line-num:cont |
|
|
268 | assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |
|
269 | 269 | assert_select 'h2', :text => /2f9c0091/ |
|
270 | 270 | end |
|
271 | 271 | end |
@@ -286,7 +286,7 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
286 | 286 | assert_response :success |
|
287 | 287 | assert_template 'diff' |
|
288 | 288 | # Line 22 removed |
|
289 |
assert_select 'th.line-num:cont |
|
|
289 | assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |
|
290 | 290 | assert_select 'h2', :text => /2f9c0091/ |
|
291 | 291 | end |
|
292 | 292 | end |
@@ -293,7 +293,7 class RepositoriesMercurialControllerTest < ActionController::TestCase | |||
|
293 | 293 | assert_template 'diff' |
|
294 | 294 | if @diff_c_support |
|
295 | 295 | # Line 22 removed |
|
296 |
assert_select 'th.line-num:cont |
|
|
296 | assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |
|
297 | 297 | assert_select 'h2', :text => /4:def6d2f1254a/ |
|
298 | 298 | end |
|
299 | 299 | end |
@@ -315,8 +315,8 class SearchControllerTest < ActionController::TestCase | |||
|
315 | 315 | get :index, :q => 'escaped_once' |
|
316 | 316 | assert_response :success |
|
317 | 317 | assert_select '#search-results' do |
|
318 |
assert_select 'dt.issue a', :text => / |
|
|
319 |
assert_select 'dd', :text => / |
|
|
318 | assert_select 'dt.issue a', :text => /<subject>/ | |
|
319 | assert_select 'dd', :text => /<description>/ | |
|
320 | 320 | end |
|
321 | 321 | end |
|
322 | 322 |
@@ -139,9 +139,9 class SettingsControllerTest < ActionController::TestCase | |||
|
139 | 139 | def test_get_plugin_settings |
|
140 | 140 | ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins")) |
|
141 | 141 | Redmine::Plugin.register :foo do |
|
142 |
settings :partial => "foo_plugin/foo_plugin_settings" |
|
|
143 | :default => {'sample_setting' => 'Plugin setting value'} | |
|
142 | settings :partial => "foo_plugin/foo_plugin_settings" | |
|
144 | 143 | end |
|
144 | Setting.plugin_foo = {'sample_setting' => 'Plugin setting value'} | |
|
145 | 145 | |
|
146 | 146 | get :plugin, :id => 'foo' |
|
147 | 147 | assert_response :success |
@@ -667,7 +667,7 class TimelogControllerTest < ActionController::TestCase | |||
|
667 | 667 | assert_select 'form[action=?][method=get]', '/projects/ecookbook/time_entries.csv' do |
|
668 | 668 | # filter |
|
669 | 669 | assert_select 'input[name=?][value=?]', 'f[]', 'spent_on' |
|
670 |
assert_select 'input[name=?][value=?]', 'op[spent_on]', ' |
|
|
670 | assert_select 'input[name=?][value=?]', 'op[spent_on]', '>=' | |
|
671 | 671 | assert_select 'input[name=?][value=?]', 'v[spent_on][]', '2007-04-01' |
|
672 | 672 | # columns |
|
673 | 673 | assert_select 'input[name=?][value=?]', 'c[]', 'spent_on' |
@@ -127,7 +127,7 class WelcomeControllerTest < ActionController::TestCase | |||
|
127 | 127 | |
|
128 | 128 | get :index |
|
129 | 129 | assert_select "#header select" do |
|
130 |
assert_select "option", :text => 'Foo & |
|
|
130 | assert_select "option", :text => 'Foo & Bar' | |
|
131 | 131 | end |
|
132 | 132 | end |
|
133 | 133 |
@@ -31,7 +31,7 class WorkflowsControllerTest < ActionController::TestCase | |||
|
31 | 31 | assert_template 'index' |
|
32 | 32 | |
|
33 | 33 | count = WorkflowTransition.where(:role_id => 1, :tracker_id => 2).count |
|
34 |
assert_select 'a[href=?]', '/workflows/edit?role_id=1& |
|
|
34 | assert_select 'a[href=?]', '/workflows/edit?role_id=1&tracker_id=2', :content => count.to_s | |
|
35 | 35 | end |
|
36 | 36 | |
|
37 | 37 | def test_get_edit |
@@ -41,7 +41,7 class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base | |||
|
41 | 41 | get '/attachments/7.xml', {}, credentials('jsmith') |
|
42 | 42 | assert_response :success |
|
43 | 43 | assert_equal 'application/xml', @response.content_type |
|
44 |
assert_select 'attachment id |
|
|
44 | assert_select 'attachment id', :text => '7' do | |
|
45 | 45 | assert_select '~ filename', :text => 'archive.zip' |
|
46 | 46 | assert_select '~ content_url', :text => 'http://www.example.com/attachments/download/7/archive.zip' |
|
47 | 47 | end |
@@ -51,7 +51,7 class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base | |||
|
51 | 51 | get '/attachments/16.xml', {}, credentials('jsmith') |
|
52 | 52 | assert_response :success |
|
53 | 53 | assert_equal 'application/xml', @response.content_type |
|
54 |
assert_select 'attachment id:cont |
|
|
54 | assert_select 'attachment id:contains(16)' do | |
|
55 | 55 | assert_select '~ thumbnail_url', :text => 'http://www.example.com/attachments/thumbnail/16' |
|
56 | 56 | end |
|
57 | 57 | end |
@@ -105,7 +105,7 class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base | |||
|
105 | 105 | assert_select 'group' do |
|
106 | 106 | assert_select 'users' do |
|
107 | 107 | assert_select 'user', Group.find(10).users.count |
|
108 | assert_select 'user[id=8]' | |
|
108 | assert_select 'user[id="8"]' | |
|
109 | 109 | end |
|
110 | 110 | end |
|
111 | 111 | end |
@@ -25,7 +25,7 class Redmine::ApiTest::IssueStatusesTest < Redmine::ApiTest::Base | |||
|
25 | 25 | |
|
26 | 26 | assert_response :success |
|
27 | 27 | assert_equal 'application/xml', @response.content_type |
|
28 |
assert_select 'issue_statuses[type=array] issue_status id |
|
|
28 | assert_select 'issue_statuses[type=array] issue_status id', :text => '2' do | |
|
29 | 29 | assert_select '~ name', :text => 'Assigned' |
|
30 | 30 | end |
|
31 | 31 | end |
@@ -74,12 +74,12 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base | |||
|
74 | 74 | assert_response :success |
|
75 | 75 | assert_equal 'application/xml', @response.content_type |
|
76 | 76 | |
|
77 |
assert_select 'issue id |
|
|
77 | assert_select 'issue id', :text => '3' do | |
|
78 | 78 | assert_select '~ relations relation', 1 |
|
79 | 79 | assert_select '~ relations relation[id="2"][issue_id="2"][issue_to_id="3"][relation_type=relates]' |
|
80 | 80 | end |
|
81 | 81 | |
|
82 |
assert_select 'issue id |
|
|
82 | assert_select 'issue id', :text => '1' do | |
|
83 | 83 | assert_select '~ relations' |
|
84 | 84 | assert_select '~ relations relation', 0 |
|
85 | 85 | end |
@@ -281,7 +281,7 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base | |||
|
281 | 281 | |
|
282 | 282 | assert_select 'issue attachments[type=array]' do |
|
283 | 283 | assert_select 'attachment', 5 |
|
284 |
assert_select 'attachment id |
|
|
284 | assert_select 'attachment id', :text => '4' do | |
|
285 | 285 | assert_select '~ filename', :text => 'source.rb' |
|
286 | 286 | assert_select '~ content_url', :text => 'http://www.example.com/attachments/download/4/source.rb' |
|
287 | 287 | end |
@@ -292,9 +292,9 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base | |||
|
292 | 292 | issue = Issue.generate_with_descendants!(:project_id => 1) |
|
293 | 293 | get "/issues/#{issue.id}.xml?include=children" |
|
294 | 294 | |
|
295 |
assert_select 'issue |
|
|
296 | assert_select 'issue', 2 | |
|
297 | assert_select 'issue children', 1 | |
|
295 | assert_select 'issue id', :text => issue.id.to_s do | |
|
296 | assert_select '~ children[type=array] > issue', 2 | |
|
297 | assert_select '~ children[type=array] > issue > children', 1 | |
|
298 | 298 | end |
|
299 | 299 | end |
|
300 | 300 | |
@@ -322,7 +322,7 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base | |||
|
322 | 322 | assert_select 'issue' do |
|
323 | 323 | assert_select 'watchers', Issue.find(1).watchers.count |
|
324 | 324 | assert_select 'watchers' do |
|
325 | assert_select 'user[id=3]' | |
|
325 | assert_select 'user[id="3"]' | |
|
326 | 326 | end |
|
327 | 327 | end |
|
328 | 328 | end |
@@ -25,9 +25,9 class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base | |||
|
25 | 25 | |
|
26 | 26 | assert_response :success |
|
27 | 27 | assert_equal 'application/xml', @response.content_type |
|
28 |
assert_select 'memberships[type=array] membership id |
|
|
29 | assert_select '~ user[id=3][name=Dave Lopper]' | |
|
30 | assert_select '~ roles role[id=2][name=Developer]' | |
|
28 | assert_select 'memberships[type=array] membership id', :text => '2' do | |
|
29 | assert_select '~ user[id="3"][name="Dave Lopper"]' | |
|
30 | assert_select '~ roles role[id="2"][name=Developer]' | |
|
31 | 31 | end |
|
32 | 32 | end |
|
33 | 33 | |
@@ -94,9 +94,9 class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base | |||
|
94 | 94 | |
|
95 | 95 | assert_response :success |
|
96 | 96 | assert_equal 'application/xml', @response.content_type |
|
97 |
assert_select 'membership id |
|
|
98 | assert_select '~ user[id=3][name=Dave Lopper]' | |
|
99 | assert_select '~ roles role[id=2][name=Developer]' | |
|
97 | assert_select 'membership id', :text => '2' do | |
|
98 | assert_select '~ user[id="3"][name="Dave Lopper"]' | |
|
99 | assert_select '~ roles role[id="2"][name=Developer]' | |
|
100 | 100 | end |
|
101 | 101 | end |
|
102 | 102 |
@@ -54,7 +54,7 class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base | |||
|
54 | 54 | assert_response :success |
|
55 | 55 | assert_equal 'application/xml', @response.content_type |
|
56 | 56 | |
|
57 | assert_select 'issue_categories[type=array] issue_category[id=2][name=Recipes]' | |
|
57 | assert_select 'issue_categories[type=array] issue_category[id="2"][name=Recipes]' | |
|
58 | 58 | end |
|
59 | 59 | |
|
60 | 60 | test "GET /projects.xml with include=trackers should return trackers" do |
@@ -62,7 +62,7 class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base | |||
|
62 | 62 | assert_response :success |
|
63 | 63 | assert_equal 'application/xml', @response.content_type |
|
64 | 64 | |
|
65 | assert_select 'trackers[type=array] tracker[id=2][name=Feature request]' | |
|
65 | assert_select 'trackers[type=array] tracker[id="2"][name="Feature request"]' | |
|
66 | 66 | end |
|
67 | 67 | |
|
68 | 68 | test "GET /projects.xml with include=enabled_modules should return enabled modules" do |
@@ -81,7 +81,7 class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base | |||
|
81 | 81 | assert_select 'project>id', :text => '1' |
|
82 | 82 | assert_select 'project>status', :text => '1' |
|
83 | 83 | assert_select 'project>is_public', :text => 'true' |
|
84 | assert_select 'custom_field[name=Development status]', :text => 'Stable' | |
|
84 | assert_select 'custom_field[name="Development status"]', :text => 'Stable' | |
|
85 | 85 | |
|
86 | 86 | assert_select 'trackers', 0 |
|
87 | 87 | assert_select 'issue_categories', 0 |
@@ -111,7 +111,7 class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base | |||
|
111 | 111 | assert_response :success |
|
112 | 112 | assert_equal 'application/xml', @response.content_type |
|
113 | 113 | |
|
114 | assert_select 'issue_categories[type=array] issue_category[id=2][name=Recipes]' | |
|
114 | assert_select 'issue_categories[type=array] issue_category[id="2"][name=Recipes]' | |
|
115 | 115 | end |
|
116 | 116 | |
|
117 | 117 | test "GET /projects/:id.xml with include=trackers should return trackers" do |
@@ -119,7 +119,7 class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base | |||
|
119 | 119 | assert_response :success |
|
120 | 120 | assert_equal 'application/xml', @response.content_type |
|
121 | 121 | |
|
122 | assert_select 'trackers[type=array] tracker[id=2][name=Feature request]' | |
|
122 | assert_select 'trackers[type=array] tracker[id="2"][name="Feature request"]' | |
|
123 | 123 | end |
|
124 | 124 | |
|
125 | 125 | test "GET /projects/:id.xml with include=enabled_modules should return enabled modules" do |
@@ -32,7 +32,7 class Redmine::ApiTest::QueriesTest < Redmine::ApiTest::Base | |||
|
32 | 32 | |
|
33 | 33 | assert_response :success |
|
34 | 34 | assert_equal 'application/xml', @response.content_type |
|
35 |
assert_select 'queries[type=array] query id |
|
|
35 | assert_select 'queries[type=array] query id', :text => '4' do | |
|
36 | 36 | assert_select '~ name', :text => 'Public query for all projects' |
|
37 | 37 | end |
|
38 | 38 | end |
@@ -27,7 +27,7 class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base | |||
|
27 | 27 | assert_equal 'application/xml', @response.content_type |
|
28 | 28 | assert_equal 3, assigns(:roles).size |
|
29 | 29 | |
|
30 |
assert_select 'roles[type=array] role id |
|
|
30 | assert_select 'roles[type=array] role id', :text => '2' do | |
|
31 | 31 | assert_select '~ name', :text => 'Developer' |
|
32 | 32 | end |
|
33 | 33 | end |
@@ -26,7 +26,7 class Redmine::ApiTest::TrackersTest < Redmine::ApiTest::Base | |||
|
26 | 26 | assert_response :success |
|
27 | 27 | assert_equal 'application/xml', @response.content_type |
|
28 | 28 | |
|
29 |
assert_select 'trackers[type=array] tracker id |
|
|
29 | assert_select 'trackers[type=array] tracker id', :text => '2' do | |
|
30 | 30 | assert_select '~ name', :text => 'Feature request' |
|
31 | 31 | end |
|
32 | 32 | end |
@@ -33,7 +33,7 class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base | |||
|
33 | 33 | assert_response :success |
|
34 | 34 | assert_equal 'application/xml', @response.content_type |
|
35 | 35 | |
|
36 |
assert_select 'versions[type=array] version id |
|
|
36 | assert_select 'versions[type=array] version id', :text => '2' do | |
|
37 | 37 | assert_select '~ name', :text => '1.0' |
|
38 | 38 | end |
|
39 | 39 | end |
@@ -172,7 +172,7 class IssuesTest < Redmine::IntegrationTest | |||
|
172 | 172 | |
|
173 | 173 | # Issue view |
|
174 | 174 | follow_redirect! |
|
175 |
assert_select 'th:cont |
|
|
175 | assert_select 'th:contains("Tester:") + td', :text => tester.name | |
|
176 | 176 | assert_select 'select[name=?]', "issue[custom_field_values][#{@field.id}]" do |
|
177 | 177 | assert_select 'option', users.size + 1 # +1 for blank value |
|
178 | 178 | assert_select 'option[value=?][selected=selected]', tester.id.to_s, :text => tester.name |
@@ -105,11 +105,11 class LayoutTest < Redmine::IntegrationTest | |||
|
105 | 105 | |
|
106 | 106 | def test_search_field_outside_project_should_link_to_global_search |
|
107 | 107 | get '/' |
|
108 | assert_select 'div#quick-search form[action=/search]' | |
|
108 | assert_select 'div#quick-search form[action="/search"]' | |
|
109 | 109 | end |
|
110 | 110 | |
|
111 | 111 | def test_search_field_inside_project_should_link_to_project_search |
|
112 | 112 | get '/projects/ecookbook' |
|
113 | assert_select 'div#quick-search form[action=/projects/ecookbook/search]' | |
|
113 | assert_select 'div#quick-search form[action="/projects/ecookbook/search"]' | |
|
114 | 114 | end |
|
115 | 115 | end |
@@ -20,6 +20,7 require File.expand_path('../../../../test_helper', __FILE__) | |||
|
20 | 20 | class ThemesTest < Redmine::IntegrationTest |
|
21 | 21 | |
|
22 | 22 | def setup |
|
23 | Redmine::Themes.rescan | |
|
23 | 24 | @theme = Redmine::Themes.themes.last |
|
24 | 25 | Setting.ui_theme = @theme.id |
|
25 | 26 | end |
@@ -32,14 +33,14 class ThemesTest < Redmine::IntegrationTest | |||
|
32 | 33 | get '/' |
|
33 | 34 | |
|
34 | 35 | assert_response :success |
|
35 |
assert_select "link[rel=stylesheet][href^=/themes/#{@theme.dir}/stylesheets/application.css |
|
|
36 | assert_select "link[rel=stylesheet][href^=?]", "/themes/#{@theme.dir}/stylesheets/application.css" | |
|
36 | 37 | end |
|
37 | 38 | |
|
38 | 39 | def test_without_theme_js |
|
39 | 40 | get '/' |
|
40 | 41 | |
|
41 | 42 | assert_response :success |
|
42 |
assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js |
|
|
43 | assert_select "script[src^=?]", "/themes/#{@theme.dir}/javascripts/theme.js", 0 | |
|
43 | 44 | end |
|
44 | 45 | |
|
45 | 46 | def test_with_theme_js |
@@ -48,7 +49,7 class ThemesTest < Redmine::IntegrationTest | |||
|
48 | 49 | get '/' |
|
49 | 50 | |
|
50 | 51 | assert_response :success |
|
51 |
assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js |
|
|
52 | assert_select "script[src^=?]", "/themes/#{@theme.dir}/javascripts/theme.js", 1 | |
|
52 | 53 | ensure |
|
53 | 54 | @theme.javascripts.delete 'theme' |
|
54 | 55 | end |
@@ -57,7 +58,7 class ThemesTest < Redmine::IntegrationTest | |||
|
57 | 58 | get '/' |
|
58 | 59 | |
|
59 | 60 | assert_response :success |
|
60 | assert_select 'link[rel=shortcut icon][href^=/favicon.ico]' | |
|
61 | assert_select 'link[rel="shortcut icon"][href^="/favicon.ico"]' | |
|
61 | 62 | end |
|
62 | 63 | |
|
63 | 64 | def test_use_theme_favicon_if_theme_provides_one |
@@ -66,7 +67,7 class ThemesTest < Redmine::IntegrationTest | |||
|
66 | 67 | get '/' |
|
67 | 68 | |
|
68 | 69 | assert_response :success |
|
69 |
assert_select " |
|
|
70 | assert_select 'link[rel="shortcut icon"][href^=?]', "/themes/#{@theme.dir}/favicon/a.ico" | |
|
70 | 71 | ensure |
|
71 | 72 | @theme.favicons.delete 'a.ico' |
|
72 | 73 | end |
@@ -76,8 +77,8 class ThemesTest < Redmine::IntegrationTest | |||
|
76 | 77 | get '/' |
|
77 | 78 | |
|
78 | 79 | assert_response :success |
|
79 |
assert_select |
|
|
80 |
assert_select " |
|
|
80 | assert_select 'link[rel="shortcut icon"]', 1 | |
|
81 | assert_select 'link[rel="shortcut icon"][href^=?]', "/themes/#{@theme.dir}/favicon/b.ico" | |
|
81 | 82 | ensure |
|
82 | 83 | @theme.favicons.delete("b.ico") |
|
83 | 84 | @theme.favicons.delete("a.png") |
@@ -90,9 +91,9 class ThemesTest < Redmine::IntegrationTest | |||
|
90 | 91 | get '/' |
|
91 | 92 | |
|
92 | 93 | assert_response :success |
|
93 |
assert_select "link[rel=stylesheet][href^=/foo/themes/#{@theme.dir}/stylesheets/application.css |
|
|
94 |
assert_select "script[src^=/foo/themes/#{@theme.dir}/javascripts/theme.js |
|
|
95 |
assert_select " |
|
|
94 | assert_select "link[rel=stylesheet][href^=?]", "/foo/themes/#{@theme.dir}/stylesheets/application.css" | |
|
95 | assert_select "script[src^=?]", "/foo/themes/#{@theme.dir}/javascripts/theme.js" | |
|
96 | assert_select 'link[rel="shortcut icon"][href^=?]', "/foo/themes/#{@theme.dir}/favicon/a.ico" | |
|
96 | 97 | ensure |
|
97 | 98 | Redmine::Utils.relative_url_root = '' |
|
98 | 99 | end |
@@ -31,6 +31,7 require File.expand_path(File.dirname(__FILE__) + '/object_helpers') | |||
|
31 | 31 | include ObjectHelpers |
|
32 | 32 | |
|
33 | 33 | require 'net/ldap' |
|
34 | require 'mocha/setup' | |
|
34 | 35 | |
|
35 | 36 | class ActionView::TestCase |
|
36 | 37 | helper :application |
@@ -189,10 +190,18 class ActiveSupport::TestCase | |||
|
189 | 190 | end |
|
190 | 191 | |
|
191 | 192 | def assert_select_in(text, *args, &block) |
|
192 |
d = HTML |
|
|
193 | d = Nokogiri::HTML(CGI::unescapeHTML(String.new(text))).root | |
|
193 | 194 | assert_select(d, *args, &block) |
|
194 | 195 | end |
|
195 | 196 | |
|
197 | def assert_select_email(*args, &block) | |
|
198 | email = ActionMailer::Base.deliveries.last | |
|
199 | assert_not_nil email | |
|
200 | html_body = email.parts.detect {|part| part.content_type.include?('text/html')}.try(&:body) | |
|
201 | assert_not_nil html_body | |
|
202 | assert_select_in html_body.encoded, *args, &block | |
|
203 | end | |
|
204 | ||
|
196 | 205 | def assert_mail_body_match(expected, mail, message=nil) |
|
197 | 206 | if expected.is_a?(String) |
|
198 | 207 | assert_include expected, mail_body(mail), message |
|
1 | NO CONTENT: file renamed from test/ui/issues_test.rb to test/ui/issues_test_ui.rb |
@@ -1217,15 +1217,15 RAW | |||
|
1217 | 1217 | result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "") |
|
1218 | 1218 | |
|
1219 | 1219 | # heading that contains inline code |
|
1220 |
assert_match Regexp.new('<div class="contextual" |
|
|
1221 |
'<a href="/projects/1/wiki/Test/edit\?section=4"><img |
|
|
1220 | assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-4">' + | |
|
1221 | '<a href="/projects/1/wiki/Test/edit\?section=4"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' + | |
|
1222 | 1222 | '<a name="Subtitle-with-inline-code"></a>' + |
|
1223 | 1223 | '<h2 >Subtitle with <code>inline code</code><a href="#Subtitle-with-inline-code" class="wiki-anchor">¶</a></h2>'), |
|
1224 | 1224 | result |
|
1225 | 1225 | |
|
1226 | 1226 | # last heading |
|
1227 |
assert_match Regexp.new('<div class="contextual" |
|
|
1228 |
'<a href="/projects/1/wiki/Test/edit\?section=5"><img |
|
|
1227 | assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-5">' + | |
|
1228 | '<a href="/projects/1/wiki/Test/edit\?section=5"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' + | |
|
1229 | 1229 | '<a name="Subtitle-after-pre-tag"></a>' + |
|
1230 | 1230 | '<h2 >Subtitle after pre tag<a href="#Subtitle-after-pre-tag" class="wiki-anchor">¶</a></h2>'), |
|
1231 | 1231 | result |
@@ -1323,8 +1323,9 RAW | |||
|
1323 | 1323 | |
|
1324 | 1324 | def test_thumbnail_tag |
|
1325 | 1325 | a = Attachment.find(3) |
|
1326 | assert_equal '<a href="/attachments/3/logo.gif" title="logo.gif"><img alt="3" src="/attachments/thumbnail/3" /></a>', | |
|
1327 | thumbnail_tag(a) | |
|
1326 | assert_select_in thumbnail_tag(a), | |
|
1327 | 'a[href=?][title=?] img[alt="3"][src=?]', | |
|
1328 | "/attachments/3/logo.gif", "logo.gif", "/attachments/thumbnail/3" | |
|
1328 | 1329 | end |
|
1329 | 1330 | |
|
1330 | 1331 | def test_link_to_project |
@@ -28,7 +28,7 class GroupsHelperTest < ActionView::TestCase | |||
|
28 | 28 | group = Group.generate! |
|
29 | 29 | |
|
30 | 30 | result = render_principals_for_new_group_users(group) |
|
31 | assert_select_in result, 'input[name=?][value=2]', 'user_ids[]' | |
|
31 | assert_select_in result, 'input[name=?][value="2"]', 'user_ids[]' | |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | def test_render_principals_for_new_group_users_with_limited_results_should_paginate |
@@ -29,7 +29,7 class MembersHelperTest < ActionView::TestCase | |||
|
29 | 29 | project = Project.generate! |
|
30 | 30 | |
|
31 | 31 | result = render_principals_for_new_members(project) |
|
32 | assert_select_in result, 'input[name=?][value=2]', 'membership[user_ids][]' | |
|
32 | assert_select_in result, 'input[name=?][value="2"]', 'membership[user_ids][]' | |
|
33 | 33 | end |
|
34 | 34 | |
|
35 | 35 | def test_render_principals_for_new_members_with_limited_results_should_paginate |
@@ -42,12 +42,12 class ProjectsHelperTest < ActionView::TestCase | |||
|
42 | 42 | def test_link_to_version_within_project |
|
43 | 43 | @project = Project.find(2) |
|
44 | 44 | User.current = User.find(1) |
|
45 |
assert_equal '<a |
|
|
45 | assert_equal '<a title="07/01/2006" href="/versions/5">Alpha</a>', link_to_version(Version.find(5)) | |
|
46 | 46 | end |
|
47 | 47 | |
|
48 | 48 | def test_link_to_version |
|
49 | 49 | User.current = User.find(1) |
|
50 |
assert_equal '<a |
|
|
50 | assert_equal '<a title="07/01/2006" href="/versions/5">Alpha</a>', link_to_version(Version.find(5)) | |
|
51 | 51 | end |
|
52 | 52 | |
|
53 | 53 | def test_link_to_version_without_effective_date |
@@ -128,14 +128,14 class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |||
|
128 | 128 | setup_subjects |
|
129 | 129 | @output_buffer = @gantt.subjects |
|
130 | 130 | assert_select "div.project-name a", /#{@project.name}/ |
|
131 |
assert_select |
|
|
131 | assert_select 'div.project-name[style*="left:4px"]' | |
|
132 | 132 | end |
|
133 | 133 | |
|
134 | 134 | test "#subjects version should be rendered" do |
|
135 | 135 | setup_subjects |
|
136 | 136 | @output_buffer = @gantt.subjects |
|
137 | 137 | assert_select "div.version-name a", /#{@version.name}/ |
|
138 |
assert_select |
|
|
138 | assert_select 'div.version-name[style*="left:24px"]' | |
|
139 | 139 | end |
|
140 | 140 | |
|
141 | 141 | test "#subjects version without assigned issues should not be rendered" do |
@@ -152,7 +152,7 class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |||
|
152 | 152 | setup_subjects |
|
153 | 153 | @output_buffer = @gantt.subjects |
|
154 | 154 | assert_select "div.issue-subject", /#{@issue.subject}/ |
|
155 |
assert_select |
|
|
155 | assert_select 'div.issue-subject[style*="left:44px"]' | |
|
156 | 156 | end |
|
157 | 157 | |
|
158 | 158 | test "#subjects issue assigned to a shared version of another project should be rendered" do |
@@ -197,12 +197,12 class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |||
|
197 | 197 | ) |
|
198 | 198 | @output_buffer = @gantt.subjects |
|
199 | 199 | # parent task 44px |
|
200 |
assert_select |
|
|
200 | assert_select 'div.issue-subject[style*="left:44px"]', /#{@issue.subject}/ | |
|
201 | 201 | # children 64px |
|
202 |
assert_select |
|
|
203 |
assert_select |
|
|
202 | assert_select 'div.issue-subject[style*="left:64px"]', /child1/ | |
|
203 | assert_select 'div.issue-subject[style*="left:64px"]', /child2/ | |
|
204 | 204 | # grandchild 84px |
|
205 |
assert_select |
|
|
205 | assert_select 'div.issue-subject[style*="left:84px"]', /grandchild/, @output_buffer | |
|
206 | 206 | end |
|
207 | 207 | |
|
208 | 208 | test "#lines" do |
@@ -298,7 +298,7 class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |||
|
298 | 298 | test "#subject should use the indent option to move the div to the right" do |
|
299 | 299 | create_gantt |
|
300 | 300 | @output_buffer = @gantt.subject('subject', :format => :html, :indent => 40) |
|
301 |
assert_select |
|
|
301 | assert_select 'div[style*="left:40"]' | |
|
302 | 302 | end |
|
303 | 303 | |
|
304 | 304 | test "#line_for_project" do |
@@ -332,65 +332,65 class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |||
|
332 | 332 | test "#line todo line should start from the starting point on the left" do |
|
333 | 333 | create_gantt |
|
334 | 334 | @output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4) |
|
335 |
assert_select |
|
|
335 | assert_select 'div.task_todo[style*="left:28px"]', 1 | |
|
336 | 336 | end |
|
337 | 337 | |
|
338 | 338 | test "#line todo line should be the total width" do |
|
339 | 339 | create_gantt |
|
340 | 340 | @output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4) |
|
341 |
assert_select |
|
|
341 | assert_select 'div.task_todo[style*="width:58px"]', 1 | |
|
342 | 342 | end |
|
343 | 343 | |
|
344 | 344 | test "#line late line should start from the starting point on the left" do |
|
345 | 345 | create_gantt |
|
346 | 346 | @output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4) |
|
347 |
assert_select |
|
|
347 | assert_select 'div.task_late[style*="left:28px"]', 1 | |
|
348 | 348 | end |
|
349 | 349 | |
|
350 | 350 | test "#line late line should be the total delayed width" do |
|
351 | 351 | create_gantt |
|
352 | 352 | @output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4) |
|
353 |
assert_select |
|
|
353 | assert_select 'div.task_late[style*="width:30px"]', 1 | |
|
354 | 354 | end |
|
355 | 355 | |
|
356 | 356 | test "#line done line should start from the starting point on the left" do |
|
357 | 357 | create_gantt |
|
358 | 358 | @output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4) |
|
359 |
assert_select |
|
|
359 | assert_select 'div.task_done[style*="left:28px"]', 1 | |
|
360 | 360 | end |
|
361 | 361 | |
|
362 | 362 | test "#line done line should be the width for the done ratio" do |
|
363 | 363 | create_gantt |
|
364 | 364 | @output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4) |
|
365 | 365 | # 15 days * 4 px * 30% - 2 px for borders = 16 px |
|
366 |
assert_select |
|
|
366 | assert_select 'div.task_done[style*="width:16px"]', 1 | |
|
367 | 367 | end |
|
368 | 368 | |
|
369 | 369 | test "#line done line should be the total width for 100% done ratio" do |
|
370 | 370 | create_gantt |
|
371 | 371 | @output_buffer = @gantt.line(today - 7, today + 7, 100, false, 'line', :format => :html, :zoom => 4) |
|
372 | 372 | # 15 days * 4 px - 2 px for borders = 58 px |
|
373 |
assert_select |
|
|
373 | assert_select 'div.task_done[style*="width:58px"]', 1 | |
|
374 | 374 | end |
|
375 | 375 | |
|
376 | 376 | test "#line done line should be the total width for 100% done ratio with same start and end dates" do |
|
377 | 377 | create_gantt |
|
378 | 378 | @output_buffer = @gantt.line(today + 7, today + 7, 100, false, 'line', :format => :html, :zoom => 4) |
|
379 |
assert_select |
|
|
379 | assert_select 'div.task_done[style*="width:2px"]', 1 | |
|
380 | 380 | end |
|
381 | 381 | |
|
382 | 382 | test "#line done line should not be the total done width if the gantt starts after start date" do |
|
383 | 383 | create_gantt |
|
384 | 384 | @output_buffer = @gantt.line(today - 16, today - 2, 30, false, 'line', :format => :html, :zoom => 4) |
|
385 |
assert_select |
|
|
386 |
assert_select |
|
|
385 | assert_select 'div.task_done[style*="left:0px"]', 1 | |
|
386 | assert_select 'div.task_done[style*="width:8px"]', 1 | |
|
387 | 387 | end |
|
388 | 388 | |
|
389 | 389 | test "#line starting marker should appear at the start date" do |
|
390 | 390 | create_gantt |
|
391 | 391 | @output_buffer = @gantt.line(today - 7, today + 7, 30, true, 'line', :format => :html, :zoom => 4) |
|
392 | 392 | assert_select "div.starting", 1 |
|
393 |
assert_select |
|
|
393 | assert_select 'div.starting[style*="left:28px"]', 1 | |
|
394 | 394 | end |
|
395 | 395 | |
|
396 | 396 | test "#line starting marker should not appear if the start date is before gantt start date" do |
@@ -403,7 +403,7 class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |||
|
403 | 403 | create_gantt |
|
404 | 404 | @output_buffer = @gantt.line(today - 7, today + 7, 30, true, 'line', :format => :html, :zoom => 4) |
|
405 | 405 | assert_select "div.ending", 1 |
|
406 |
assert_select |
|
|
406 | assert_select 'div.ending[style*="left:88px"]', 1 | |
|
407 | 407 | end |
|
408 | 408 | |
|
409 | 409 | test "#line ending marker should not appear if the end date is before gantt start date" do |
@@ -51,14 +51,14 class Redmine::MenuManager::MenuHelperTest < ActionView::TestCase | |||
|
51 | 51 | node = Redmine::MenuManager::MenuItem.new(:testing, :issues_path) |
|
52 | 52 | @output_buffer = render_menu_node(node, nil) |
|
53 | 53 | |
|
54 |
assert_select |
|
|
54 | assert_select 'a[href="/issues"]', "Testing" | |
|
55 | 55 | end |
|
56 | 56 | |
|
57 | 57 | def test_render_menu_node_with_symbol_as_url_and_project |
|
58 | 58 | node = Redmine::MenuManager::MenuItem.new(:testing, :project_issues_path) |
|
59 | 59 | @output_buffer = render_menu_node(node, Project.find(1)) |
|
60 | 60 | |
|
61 |
assert_select |
|
|
61 | assert_select 'a[href="/projects/ecookbook/issues"]', "Testing" | |
|
62 | 62 | end |
|
63 | 63 | |
|
64 | 64 | def test_render_menu_node_with_nested_items |
@@ -19,7 +19,7 require File.expand_path('../../test_helper', __FILE__) | |||
|
19 | 19 | |
|
20 | 20 | class MailerTest < ActiveSupport::TestCase |
|
21 | 21 | include Redmine::I18n |
|
22 | include ActionDispatch::Assertions::SelectorAssertions | |
|
22 | include Rails::Dom::Testing::Assertions | |
|
23 | 23 | fixtures :projects, :enabled_modules, :issues, :users, :email_addresses, :members, |
|
24 | 24 | :member_roles, :roles, :documents, :attachments, :news, |
|
25 | 25 | :tokens, :journals, :journal_details, :changesets, |
@@ -61,11 +61,14 class MailerTest < ActiveSupport::TestCase | |||
|
61 | 61 | # link to a changeset |
|
62 | 62 | assert_select 'a[href=?][title=?]', |
|
63 | 63 | 'https://mydomain.foo/projects/ecookbook/repository/revisions/2', |
|
64 |
'This commit fixes #1, #2 and references #1 & |
|
|
64 | 'This commit fixes #1, #2 and references #1 & #3', | |
|
65 | 65 | :text => 'r2' |
|
66 | 66 | # link to a description diff |
|
67 | assert_select 'a[href=?][title=?]', | |
|
68 |
|
|
|
67 | assert_select 'a[href^=?][title=?]', | |
|
68 | # should be https://mydomain.foo/journals/diff/3?detail_id=4 | |
|
69 | # but the Rails 4.2 DOM assertion doesn't handle the ? in the | |
|
70 | # attribute value | |
|
71 | 'https://mydomain.foo/journals/diff/3', | |
|
69 | 72 | 'View differences', |
|
70 | 73 | :text => 'diff' |
|
71 | 74 | # link to an attachment |
@@ -100,11 +103,14 class MailerTest < ActiveSupport::TestCase | |||
|
100 | 103 | # link to a changeset |
|
101 | 104 | assert_select 'a[href=?][title=?]', |
|
102 | 105 | 'http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2', |
|
103 |
'This commit fixes #1, #2 and references #1 & |
|
|
106 | 'This commit fixes #1, #2 and references #1 & #3', | |
|
104 | 107 | :text => 'r2' |
|
105 | 108 | # link to a description diff |
|
106 | assert_select 'a[href=?][title=?]', | |
|
107 |
|
|
|
109 | assert_select 'a[href^=?][title=?]', | |
|
110 | # should be http://mydomain.foo/rdm/journals/diff/3?detail_id=4 | |
|
111 | # but the Rails 4.2 DOM assertion doesn't handle the ? in the | |
|
112 | # attribute value | |
|
113 | 'http://mydomain.foo/rdm/journals/diff/3', | |
|
108 | 114 | 'View differences', |
|
109 | 115 | :text => 'diff' |
|
110 | 116 | # link to an attachment |
@@ -150,11 +156,14 class MailerTest < ActiveSupport::TestCase | |||
|
150 | 156 | # link to a changeset |
|
151 | 157 | assert_select 'a[href=?][title=?]', |
|
152 | 158 | 'http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2', |
|
153 |
'This commit fixes #1, #2 and references #1 & |
|
|
159 | 'This commit fixes #1, #2 and references #1 & #3', | |
|
154 | 160 | :text => 'r2' |
|
155 | 161 | # link to a description diff |
|
156 | assert_select 'a[href=?][title=?]', | |
|
157 |
|
|
|
162 | assert_select 'a[href^=?][title=?]', | |
|
163 | # should be http://mydomain.foo/rdm/journals/diff/3?detail_id=4 | |
|
164 | # but the Rails 4.2 DOM assertion doesn't handle the ? in the | |
|
165 | # attribute value | |
|
166 | 'http://mydomain.foo/rdm/journals/diff/3', | |
|
158 | 167 | 'View differences', |
|
159 | 168 | :text => 'diff' |
|
160 | 169 | # link to an attachment |
@@ -762,10 +771,6 class MailerTest < ActiveSupport::TestCase | |||
|
762 | 771 | end |
|
763 | 772 | end |
|
764 | 773 | |
|
765 | def test_mail_should_return_a_mail_message | |
|
766 | assert_kind_of ::Mail::Message, Mailer.test_email(User.find(1)) | |
|
767 | end | |
|
768 | ||
|
769 | 774 | def test_with_synched_deliveries_should_yield_with_synced_deliveries |
|
770 | 775 | ActionMailer::Base.delivery_method = :async_smtp |
|
771 | 776 | ActionMailer::Base.async_smtp_settings = {:foo => 'bar'} |
General Comments 0
You need to be logged in to leave comments.
Login now