def test_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :params => {
+ get(
+ :new,
+ :params => {
:project_id => 'subproject1',
:repository_scm => 'Subversion'
}
+ )
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Subversion'
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :params => {
+ get(
+ :show,
+ :params => {
:id => PRJ_ID
}
+ )
assert_response :success
assert_select 'table.entries tbody' do
Repository::Subversion.create(:project => @project,
:url => self.class.subversion_repository_url,
:is_default => false, :identifier => 'svn')
-
- get :show, :params => {
+ get(
+ :show,
+ :params => {
:id => PRJ_ID,
:repository_id => 'svn'
}
+ )
assert_response :success
assert_select 'tr.dir a[href="/projects/subproject1/repository/svn/show/subversion_test"]'
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :params => {
+ get(
+ :show,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test'])[:param]
}
+ )
assert_response :success
assert_select 'table.entries tbody' do
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :params => {
+ get(
+ :show,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test'])[:param],
:rev => 4
}
+ )
assert_response :success
assert_select 'table.entries tbody' do
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :changes, :params => {
+ get(
+ :changes,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'folder', 'helloworld.rb'])[:param]
}
+ )
assert_response :success
assert_select 'table.changesets tbody' do
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :changes, :params => {
+ get(
+ :changes,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'folder'])[:param]
}
+ )
assert_response :success
assert_select 'table.changesets tbody' do
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :params => {
+ get(
+ :entry,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
}
+ )
assert_response :success
assert_select 'h2 a', :text => 'subversion_test'
assert_select 'h2 a', :text => 'helloworld.c'
assert_equal NUM_REV, @repository.changesets.count
# no files in the test repo is larger than 1KB...
with_settings :file_max_size_displayed => 0 do
- get :entry, :params => {
+ get(
+ :entry,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
}
+ )
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'p.nodata'
end
def test_entry_should_display_images
- get :entry, :params => {
+ get(
+ :entry,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'rubylogo.gif'])[:param]
}
+ )
assert_response :success
assert_select 'img[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/rubylogo.gif"
end
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :params => {
+ get(
+ :entry,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'helloworld.rb'])[:param],
:rev => 2
}
+ )
assert_response :success
# this line was removed in r3 and file was moved in r6
assert_select 'td.line-code', :text => /Here's the code/
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :params => {
+ get(
+ :entry,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'zzz.c'])[:param]
}
+ )
assert_select 'p#errorExplanation', :text => /The entry or revision was not found in the repository/
end
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :raw, :params => {
+ get(
+ :raw,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
}
+ )
assert_response :success
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
end
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :params => {
+ get(
+ :entry,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'folder'])[:param]
}
+ )
assert_response :success
assert_select 'h2 a', :text => 'subversion_test'
assert_select 'h2 a', :text => 'folder'
# TODO: this test needs fixtures.
def test_revision
- get :revision, :params => {
+ get(
+ :revision,
+ :params => {
:id => 1,
:repository_id => 10,
:rev => 2
}
+ )
assert_response :success
assert_select 'ul' do
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :revision, :params => {
+ get(
+ :revision,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:rev => 'something_weird'
}
+ )
assert_response 404
assert_select_error /was not found/
end
def test_invalid_revision_diff
- get :diff, :params => {
+ get(
+ :diff,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:rev => '1',
:rev_to => 'something_weird'
}
+ )
assert_response 404
assert_select_error /was not found/
end
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['', ' ', nil].each do |r|
- get :revision, :params => {
+ get(
+ :revision,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:rev => r
}
+ )
assert_response 404
assert_select_error /was not found/
end
r = Project.find(1).repository
# Changes repository url to a subdirectory
r.update_attribute :url, (r.url + '/test/some')
-
- get :revision, :params => {
+ get(
+ :revision,
+ :params => {
:id => 1,
:repository_id => 10,
:rev => 2
}
+ )
assert_response :success
assert_select 'ul' do
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt|
- get :diff, :params => {
+ get(
+ :diff,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:rev => 3,
:type => dt
}
+ )
assert_response :success
assert_select 'h2', :text => /Revision 3/
assert_select 'th.filename', :text => 'subversion_test/textfile.txt'
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
-
- get :diff, :params => {
+ get(
+ :diff,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:rev => 5,
:format => 'diff'
}
+ )
assert_response :success
assert_equal 'text/x-patch', @response.content_type
assert_equal 'Index: subversion_test/folder/greeter.rb', @response.body.split(/\r?\n/).first
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt|
- get :diff, :params => {
+ get(
+ :diff,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:rev => 6,
:path => repository_path_hash(['subversion_test', 'folder'])[:param],
:type => dt
}
+ )
assert_response :success
assert_select 'h2', :text => /2:6/
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :annotate, :params => {
+ get(
+ :annotate,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
}
+ )
assert_response :success
assert_select 'tr' do
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :annotate, :params => {
+ get(
+ :annotate,
+ :params => {
:id => PRJ_ID,
:repository_id => @repository.id,
:rev => 8,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
}
+ )
assert_response :success
assert_select 'h2', :text => /@ 8/
end
assert_equal NUM_REV, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :params => {
- :id => @repository.id
- }
+ delete(:destroy, :params => {:id => @repository.id})
end
assert_response 302
@project.reload
assert_equal 0, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :params => {
- :id => @repository.id
- }
+ delete(:destroy, :params => {:id => @repository.id})
end
assert_response 302
@project.reload