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