Feature #22481 » 0001-Run-test-only-when-GhostScript-is-available.patch
| test/functional/attachments_controller_test.rb | ||
|---|---|---|
|
assert_response 304
|
||
|
end
|
||
|
def test_thumbnail_for_pdf_should_be_png
|
||
|
Attachment.clear_thumbnails
|
||
|
@request.session[:user_id] = 2
|
||
|
get :thumbnail, :params => {
|
||
|
:id => 23 # ecookbook-gantt.pdf
|
||
|
}
|
||
|
assert_response :success
|
||
|
assert_equal 'image/png', response.content_type
|
||
|
end
|
||
|
def test_thumbnail_should_not_exceed_maximum_size
|
||
|
Redmine::Thumbnail.expects(:generate).with {|source, target, size| size == 800}
|
||
| ... | ... | |
|
puts '(ImageMagick convert not available)'
|
||
|
end
|
||
|
if gs_installed?
|
||
|
def test_thumbnail_for_pdf_should_be_png
|
||
|
Attachment.clear_thumbnails
|
||
|
@request.session[:user_id] = 2
|
||
|
get :thumbnail, :params => {
|
||
|
:id => 23 # ecookbook-gantt.pdf
|
||
|
}
|
||
|
assert_response :success
|
||
|
assert_equal 'image/png', response.content_type
|
||
|
end
|
||
|
else
|
||
|
puts '(GhostScript convert not available)'
|
||
|
end
|
||
|
def test_edit_all
|
||
|
@request.session[:user_id] = 2
|
||
|
get :edit_all, :params => {
|
||
| ... | ... | |
|
'1' => {
|
||
|
:filename => 'newname.text',
|
||
|
:description => ''
|
||
|
},
|
||
|
},
|
||
|
'4' => {
|
||
|
:filename => 'newname.rb',
|
||
|
:description => 'Renamed'
|
||
|
},
|
||
|
|
||
|
},
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
'1' => {
|
||
|
:filename => '',
|
||
|
:description => ''
|
||
|
},
|
||
|
},
|
||
|
'4' => {
|
||
|
:filename => 'newname.rb',
|
||
|
:description => 'Renamed'
|
||
|
},
|
||
|
|
||
|
},
|
||
|
}
|
||
|
}
|
||
| test/test_helper.rb | ||
|---|---|---|
|
self.class.convert_installed?
|
||
|
end
|
||
|
def self.gs_installed?
|
||
|
Redmine::Thumbnail.gs_available?
|
||
|
end
|
||
|
def gs_installed?
|
||
|
self.class.gs_installed?
|
||
|
end
|
||
|
# Returns the path to the test +vendor+ repository
|
||
|
def self.repository_path(vendor)
|
||
|
path = Rails.root.join("tmp/test/#{vendor.downcase}_repository").to_s
|
||
| ... | ... | |
|
module Redmine
|
||
|
class MockFile
|
||
|
attr_reader :size, :original_filename, :content_type
|
||
|
|
||
|
def initialize(options={})
|
||
|
@size = options[:size] || 32
|
||
|
@original_filename = options[:original_filename] || options[:filename]
|
||
|
@content_type = options[:content_type]
|
||
|
@content = options[:content] || 'x'*size
|
||
|
end
|
||
|
|
||
|
def read(*args)
|
||
|
if @eof
|
||
|
false
|
||
| ... | ... | |
|
ids = css_select('tr.issue td.id').map(&:text).map(&:to_i)
|
||
|
Issue.where(:id => ids).sort_by {|issue| ids.index(issue.id)}
|
||
|
end
|
||
|
|
||
|
# Return the columns that are displayed in the issue list
|
||
|
def columns_in_issues_list
|
||
|
css_select('table.issues thead th:not(.checkbox)').map(&:text).select(&:present?)
|
||
|
end
|
||
|
|
||
|
# Return the columns that are displayed in the list
|
||
|
def columns_in_list
|
||
|
css_select('table.list thead th:not(.checkbox)').map(&:text).select(&:present?)
|
||
| ... | ... | |
|
def assert_query_filters(expected_filters)
|
||
|
response.body =~ /initFilters\(\);\s*((addFilter\(.+\);\s*)*)/
|
||
|
filter_init = $1.to_s
|
||
|
|
||
|
expected_filters.each do |field, operator, values|
|
||
|
s = "addFilter(#{field.to_json}, #{operator.to_json}, #{Array(values).to_json});"
|
||
|
assert_include s, filter_init
|
||
| ... | ... | |
|
request = arg.keys.detect {|key| key.is_a?(String)}
|
||
|
raise ArgumentError unless request
|
||
|
options = arg.slice!(request)
|
||
|
|
||
|
API_FORMATS.each do |format|
|
||
|
format_request = request.sub /$/, ".#{format}"
|
||
|
super options.merge(format_request => arg[request], :format => format)
|
||
- « Previous
- 1
- …
- 7
- 8
- 9
- Next »