Commit a1dd87b2 authored by jplang's avatar jplang

Upgrade to Rails 4.2.0 (#14534).

git-svn-id: https://svn.redmine.org/redmine/trunk@13892 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent fd0249e5
source 'https://rubygems.org'
gem "rails", "4.1.8"
gem "rails", "4.2.0"
gem "jquery-rails", "~> 3.1.1"
gem "coderay", "~> 1.1.0"
gem "builder", ">= 3.0.4"
......@@ -86,7 +86,8 @@ end
group :test do
gem "minitest"
gem "mocha", "~> 1.0.0", :require => 'mocha/api'
gem "rails-dom-testing"
gem "mocha", "~> 1.0.0"
gem "simplecov", "~> 0.9.1", :require => false
# For running UI tests
gem "capybara"
......
......@@ -80,7 +80,7 @@ module ApplicationHelper
end
end
only_path = options[:only_path].nil? ? true : options[:only_path]
s = link_to(text, issue_path(issue, :only_path => only_path),
s = link_to(text, issue_url(issue, :only_path => only_path),
:class => issue.css_classes, :title => title)
s << h(": #{subject}") if subject
s = h("#{issue.project} - ") + s if options[:project]
......@@ -93,8 +93,9 @@ module ApplicationHelper
# * :download - Force download (default: false)
def link_to_attachment(attachment, options={})
text = options.delete(:text) || attachment.filename
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
route_method = options.delete(:download) ? :download_named_attachment_url : :named_attachment_url
html_options = options.slice!(:only_path)
options[:only_path] = true unless options.key?(:only_path)
url = send(route_method, attachment, attachment.filename, options)
link_to text, url, html_options
end
......@@ -120,9 +121,10 @@ module ApplicationHelper
def link_to_message(message, options={}, html_options = nil)
link_to(
message.subject.truncate(60),
board_message_path(message.board_id, message.parent_id || message.id, {
board_message_url(message.board_id, message.parent_id || message.id, {
:r => (message.parent_id && message.id),
:anchor => (message.parent_id ? "message-#{message.id}" : nil)
:anchor => (message.parent_id ? "message-#{message.id}" : nil),
:only_path => true
}.merge(options)),
html_options
)
......@@ -139,7 +141,9 @@ module ApplicationHelper
if project.archived?
h(project.name)
else
link_to project.name, project_path(project, options), html_options
link_to project.name,
project_url(project, {:only_path => true}.merge(options)),
html_options
end
end
......@@ -626,7 +630,7 @@ module ApplicationHelper
filename, ext, alt, alttext = $1.downcase, $2, $3, $4
# search for the picture in attachments
if found = Attachment.latest_attach(attachments, filename)
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path)
image_url = download_named_attachment_url(found, found.filename, :only_path => only_path)
desc = found.description.to_s.gsub('"', '')
if !desc.blank? && alttext.blank?
alt = " title=\"#{desc}\" alt=\"#{desc}\""
......@@ -769,17 +773,17 @@ module ApplicationHelper
issue = Issue.visible.find_by_id(oid)
anchor = comment_id ? "note-#{comment_id}" : nil
link = link_to("##{oid}#{comment_suffix}",
issue_path(issue, :only_path => only_path, :anchor => anchor),
issue_url(issue, :only_path => only_path, :anchor => anchor),
:class => issue.css_classes,
:title => "#{issue.subject.truncate(100)} (#{issue.status.name})")
end
when 'document'
if document = Document.visible.find_by_id(oid)
link = link_to(document.title, document_path(document, :only_path => only_path), :class => 'document')
link = link_to(document.title, document_url(document, :only_path => only_path), :class => 'document')
end
when 'version'
if version = Version.visible.find_by_id(oid)
link = link_to(version.name, version_path(version, :only_path => only_path), :class => 'version')
link = link_to(version.name, version_url(version, :only_path => only_path), :class => 'version')
end
when 'message'
if message = Message.visible.find_by_id(oid)
......@@ -787,11 +791,11 @@ module ApplicationHelper
end
when 'forum'
if board = Board.visible.find_by_id(oid)
link = link_to(board.name, project_board_path(board.project, board, :only_path => only_path), :class => 'board')
link = link_to(board.name, project_board_url(board.project, board, :only_path => only_path), :class => 'board')
end
when 'news'
if news = News.visible.find_by_id(oid)
link = link_to(news.title, news_path(news, :only_path => only_path), :class => 'news')
link = link_to(news.title, news_url(news, :only_path => only_path), :class => 'news')
end
when 'project'
if p = Project.visible.find_by_id(oid)
......@@ -805,19 +809,19 @@ module ApplicationHelper
case prefix
when 'document'
if project && document = project.documents.visible.find_by_title(name)
link = link_to(document.title, document_path(document, :only_path => only_path), :class => 'document')
link = link_to(document.title, document_url(document, :only_path => only_path), :class => 'document')
end
when 'version'
if project && version = project.versions.visible.find_by_name(name)
link = link_to(version.name, version_path(version, :only_path => only_path), :class => 'version')
link = link_to(version.name, version_url(version, :only_path => only_path), :class => 'version')
end
when 'forum'
if project && board = project.boards.visible.find_by_name(name)
link = link_to(board.name, project_board_path(board.project, board, :only_path => only_path), :class => 'board')
link = link_to(board.name, project_board_url(board.project, board, :only_path => only_path), :class => 'board')
end
when 'news'
if project && news = project.news.visible.find_by_title(name)
link = link_to(news.title, news_path(news, :only_path => only_path), :class => 'news')
link = link_to(news.title, news_url(news, :only_path => only_path), :class => 'news')
end
when 'commit', 'source', 'export'
if project
......
......@@ -76,8 +76,7 @@ class Issue < ActiveRecord::Base
attr_protected :id
scope :visible, lambda {|*args|
includes(:project).
references(:project).
joins(:project).
where(Issue.visible_condition(args.shift || User.current, *args))
}
......
......@@ -17,7 +17,6 @@
class JournalDetail < ActiveRecord::Base
belongs_to :journal
before_save :normalize_values
attr_protected :id
def custom_field
......@@ -26,13 +25,16 @@ class JournalDetail < ActiveRecord::Base
end
end
private
def value=(arg)
write_attribute :value, normalize(arg)
end
def normalize_values
self.value = normalize(value)
self.old_value = normalize(old_value)
def old_value=(arg)
write_attribute :old_value, normalize(arg)
end
private
def normalize(v)
case v
when true
......
......@@ -46,7 +46,7 @@
<td class="last_login_on"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
<td class="buttons">
<%= change_status_link(user) %>
<%= delete_link user_path(user, :back_url => users_path(params)) unless User.current == user %>
<%= delete_link user_path(user, :back_url => request.original_fullpath) unless User.current == user %>
</td>
</tr>
<% end -%>
......
......@@ -29,5 +29,7 @@ Rails.application.configure do
# Print deprecation notices to stderr and the Rails logger.
config.active_support.deprecation = [:stderr, :log]
config.secret_token = 'a secret token for running the tests'
config.secret_key_base = 'a secret token for running the tests'
config.active_support.test_order = :random
end
......@@ -146,6 +146,16 @@ module ActionMailer
end
end
# #deliver is deprecated in Rails 4.2
# Prevents massive deprecation warnings
module ActionMailer
class MessageDelivery < Delegator
def deliver
deliver_now
end
end
end
module ActionController
module MimeResponds
class Collector
......@@ -163,32 +173,8 @@ module ActionController
# TODO: remove it in a later version
def self.session=(*args)
$stderr.puts "Please remove config/initializers/session_store.rb and run `rake generate_secret_token`.\n" +
"Setting the session secret with ActionController.session= is no longer supported in Rails 3."
"Setting the session secret with ActionController.session= is no longer supported."
exit 1
end
end
end
if Rails::VERSION::MAJOR < 4 && RUBY_VERSION >= "2.1"
module ActiveSupport
class HashWithIndifferentAccess
def select(*args, &block)
dup.tap { |hash| hash.select!(*args, &block) }
end
def reject(*args, &block)
dup.tap { |hash| hash.reject!(*args, &block) }
end
end
class OrderedHash
def select(*args, &block)
dup.tap { |hash| hash.select!(*args, &block) }
end
def reject(*args, &block)
dup.tap { |hash| hash.reject!(*args, &block) }
end
end
end
end
......@@ -217,15 +217,16 @@ Rails.application.routes.draw do
get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
:to => 'repositories#changes'
get 'projects/:id/repository/:repository_id/changes(/*path)',
:to => 'repositories#changes',
:format => false
get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path)',
:controller => 'repositories',
:format => false,
:constraints => {
......@@ -236,27 +237,30 @@ Rails.application.routes.draw do
get 'projects/:id/repository/statistics', :to => 'repositories#stats'
get 'projects/:id/repository/graph', :to => 'repositories#graph'
get 'projects/:id/repository/changes(/*path(.:ext))',
:to => 'repositories#changes'
get 'projects/:id/repository/changes(/*path)',
:to => 'repositories#changes',
:format => false
get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
get 'projects/:id/repository/revision', :to => 'repositories#revision'
post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
get 'projects/:id/repository/revisions/:rev/:action(/*path)',
:controller => 'repositories',
:format => false,
:constraints => {
:action => /(browse|show|entry|raw|annotate|diff)/,
:rev => /[a-z0-9\.\-_]+/
}
get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
get 'projects/:id/repository/:repository_id/:action(/*path)',
:controller => 'repositories',
:action => /(browse|show|entry|raw|changes|annotate|diff)/
get 'projects/:id/repository/:action(/*path(.:ext))',
:action => /(browse|show|entry|raw|changes|annotate|diff)/,
:format => false
get 'projects/:id/repository/:action(/*path)',
:controller => 'repositories',
:action => /(browse|show|entry|raw|changes|annotate|diff)/
:action => /(browse|show|entry|raw|changes|annotate|diff)/,
:format => false
get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
get 'projects/:id/repository', :to => 'repositories#show', :path => nil
......
......@@ -15,7 +15,7 @@ file 'config/initializers/secret_token.rb' do
# change this key, all old sessions will become invalid! Make sure the
# secret is at least 30 characters and all random, no regular words or
# you'll be exposed to dictionary attacks.
RedmineApp::Application.config.secret_token = '#{secret}'
RedmineApp::Application.config.secret_key_base = '#{secret}'
EOF
end
end
......
......@@ -104,7 +104,7 @@ namespace :test do
Rake::TestTask.new(:ui => "db:test:prepare") do |t|
t.libs << "test"
t.verbose = true
t.test_files = FileList['test/ui/**/*_test.rb']
t.test_files = FileList['test/ui/**/*_test_ui.rb']
end
Rake::Task['test:ui'].comment = "Run the UI tests with Capybara (PhantomJS listening on port 4444 is required)"
end
......@@ -118,8 +118,8 @@ class ActivitiesControllerTest < ActionController::TestCase
assert_template 'common/feed'
assert_select 'feed' do
assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
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'
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'
assert_select 'entry' do
assert_select 'link[href=?]', 'http://test.host/issues/11'
end
......
......@@ -94,7 +94,7 @@ class AuthSourcesControllerTest < ActionController::TestCase
get :edit, :id => 1
assert_response :success
assert_select 'input[value=secret]', 0
assert_select 'input[name=dummy_password][value=?]', /x+/
assert_select 'input[name=dummy_password][value^=xxxxxx]'
end
def test_edit_invalid_should_respond_with_404
......
......@@ -117,9 +117,13 @@ class BoardsControllerTest < ActionController::TestCase
assert_select 'select[name=?]', 'board[parent_id]' do
assert_select 'option', (Project.find(1).boards.size + 1)
assert_select 'option[value=""]', :text => '&nbsp;'
assert_select 'option[value=""]'
assert_select 'option[value="1"]', :text => 'Help'
end
# &nbsp; replaced by nokogiri, not easy to test in DOM assertions
assert_not_include '<option value=""></option>', response.body
assert_include '<option value="">&nbsp;</option>', response.body
end
def test_new_without_project_boards
......
......@@ -44,15 +44,15 @@ class ContextMenusControllerTest < ActionController::TestCase
assert_select 'a.icon-del[href=?]', '/issues?ids%5B%5D=1', :text => 'Delete'
# Statuses
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bstatus_id%5D=5', :text => 'Closed'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bpriority_id%5D=8', :text => 'Immediate'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bstatus_id%5D=5', :text => 'Closed'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bpriority_id%5D=8', :text => 'Immediate'
# No inactive priorities
assert_select 'a', :text => /Inactive Priority/, :count => 0
# Versions
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=3', :text => '2.0'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3', :text => '2.0'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
# Assignees
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
end
def test_context_menu_one_issue_by_anonymous
......@@ -72,15 +72,15 @@ class ContextMenusControllerTest < ActionController::TestCase
assert_not_nil assigns(:issues)
assert_equal [1, 2], assigns(:issues).map(&:id).sort
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&amp;')
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1&amp;#{ids}", :text => 'Copy'
assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1&#{ids}", :text => 'Copy'
assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bstatus_id%5D=5", :text => 'Closed'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bpriority_id%5D=8", :text => 'Immediate'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bassigned_to_id%5D=3", :text => 'Dave Lopper'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=3", :text => 'Dave Lopper'
end
def test_context_menu_multiple_issues_of_different_projects
......@@ -91,14 +91,14 @@ class ContextMenusControllerTest < ActionController::TestCase
assert_not_nil assigns(:issues)
assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&amp;')
ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bstatus_id%5D=5", :text => 'Closed'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bpriority_id%5D=8", :text => 'Immediate'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&amp;issue%5Bassigned_to_id%5D=2", :text => 'John Smith'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate'
assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=2", :text => 'John Smith'
end
def test_context_menu_should_include_list_custom_fields
......@@ -108,11 +108,11 @@ class ContextMenusControllerTest < ActionController::TestCase
get :issues, :ids => [1]
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => 'List'
assert_select 'a[href="#"]', :text => 'List'
assert_select 'ul' do
assert_select 'a', 3
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
end
end
end
......@@ -124,7 +124,7 @@ class ContextMenusControllerTest < ActionController::TestCase
get :issues, :ids => [1, 2]
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => 'List'
assert_select 'a[href="#"]', :text => 'List'
assert_select 'ul' do
assert_select 'a', 2
assert_select 'a', :text => 'none', :count => 0
......@@ -142,7 +142,7 @@ class ContextMenusControllerTest < ActionController::TestCase
get :issues, :ids => [1]
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => 'List'
assert_select 'a[href="#"]', :text => 'List'
assert_select 'ul' do
assert_select 'a', 3
assert_select 'a.icon-checked', :text => 'Bar'
......@@ -157,12 +157,12 @@ class ContextMenusControllerTest < ActionController::TestCase
get :issues, :ids => [1]
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => 'Bool'
assert_select 'a[href="#"]', :text => 'Bool'
assert_select 'ul' do
assert_select 'a', 3
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
end
end
end
......@@ -174,11 +174,11 @@ class ContextMenusControllerTest < ActionController::TestCase
get :issues, :ids => [1]
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => 'User'
assert_select 'a[href="#"]', :text => 'User'
assert_select 'ul' do
assert_select 'a', Project.find(1).members.count + 1
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
end
end
end
......@@ -189,11 +189,11 @@ class ContextMenusControllerTest < ActionController::TestCase
get :issues, :ids => [1]
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => 'Version'
assert_select 'a[href="#"]', :text => 'Version'
assert_select 'ul' do
assert_select 'a', Project.find(1).shared_versions.count + 1
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0'
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
end
end
end
......@@ -216,7 +216,7 @@ class ContextMenusControllerTest < ActionController::TestCase
assert_response :success
assert_template 'context_menus/issues'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&amp;issue%5Bassigned_to_id%5D=2', :text => / me /
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2', :text => / me /
end
def test_context_menu_should_propose_shared_versions_for_issues_from_different_projects
......@@ -266,12 +266,12 @@ class ContextMenusControllerTest < ActionController::TestCase
get :time_entries, :ids => [1, 2]
assert_response :success
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => "Field"
assert_select 'a[href="#"]', :text => "Field"
assert_select 'ul' do
assert_select 'a', 3
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&amp;ids%5B%5D=2&amp;time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=foo", :text => 'foo'
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&amp;ids%5B%5D=2&amp;time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=bar", :text => 'bar'
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&amp;ids%5B%5D=2&amp;time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
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'
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'
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'
end
end
end
......
......@@ -371,7 +371,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_select 'a.atom[href="/issues.atom"]'
assert_select 'a.csv[href="/issues.csv"]'
assert_select 'a.pdf[href="/issues.pdf"]'
assert_select 'form#csv-export-form[action=/issues.csv]'
assert_select 'form#csv-export-form[action="/issues.csv"]'
end
def test_index_should_not_warn_when_not_exceeding_export_limit
......@@ -861,7 +861,7 @@ class IssuesControllerTest < ActionController::TestCase
get :index, :set_filter => 1, :c => %w(subject description)
assert_select 'table.issues thead th', 3 # columns: chekbox + id + subject
assert_select 'td.description[colspan=3]', :text => 'Unable to print recipes'
assert_select 'td.description[colspan="3"]', :text => 'Unable to print recipes'
get :index, :set_filter => 1, :c => %w(subject description), :format => 'pdf'
assert_response :success
......@@ -1012,7 +1012,7 @@ class IssuesControllerTest < ActionController::TestCase
@request.session[:user_id] = 2
get :show, :id => 1
assert_select 'form#issue-form[method=post][enctype=multipart/form-data]' do
assert_select 'form#issue-form[method=post][enctype="multipart/form-data"]' do
assert_select 'input[type=file][name=?]', 'attachments[dummy][file]'
end
end
......@@ -1622,7 +1622,7 @@ class IssuesControllerTest < ActionController::TestCase
@request.session[:user_id] = 2
get :new, :project_id => 1, :tracker_id => 1
assert_select 'form[id=issue-form][method=post][enctype=multipart/form-data]' do
assert_select 'form[id=issue-form][method=post][enctype="multipart/form-data"]' do
assert_select 'input[name=?][type=file]', 'attachments[dummy][file]'
end
end
......@@ -2429,7 +2429,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal orig.subject, assigns(:issue).subject
assert assigns(:issue).copy?
assert_select 'form[id=issue-form][action=/projects/ecookbook/issues]' do
assert_select 'form[id=issue-form][action="/projects/ecookbook/issues"]' do
assert_select 'select[name=?]', 'issue[project_id]' do
assert_select 'option[value="1"][selected=selected]', :text => 'eCookbook'
assert_select 'option[value="2"]:not([selected])', :text => 'OnlineStore'
......@@ -2629,7 +2629,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_not_nil assigns(:issue)
assert assigns(:issue).copy?
assert_select 'form#issue-form[action=/projects/ecookbook/issues]' do
assert_select 'form#issue-form[action="/projects/ecookbook/issues"]' do
assert_select 'select[name=?]', 'issue[project_id]' do
assert_select 'option[value="1"]:not([selected])', :text => 'eCookbook'
assert_select 'option[value="2"][selected=selected]', :text => 'OnlineStore'
......@@ -2701,7 +2701,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_select 'option[value="7"][selected=selected]', :text => 'Urgent'
end
assert_select 'input[name=?][value=2.5]', 'time_entry[hours]'
assert_select 'input[name=?][value="2.5"]', 'time_entry[hours]'