summaryrefslogtreecommitdiffstats
path: root/test/functional/repositories_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-22 09:38:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-22 09:38:21 +0000
commitf3e573b5f891c71f9395562a3f8747ecec801091 (patch)
tree7987fd3efa8ae985b532a03e7e0f529fa997258d /test/functional/repositories_controller_test.rb
parent3602cd637c9ece4e0caa42c335acb7dce719a20e (diff)
downloadredmine-f3e573b5f891c71f9395562a3f8747ecec801091.tar.gz
redmine-f3e573b5f891c71f9395562a3f8747ecec801091.zip
Replaced remaining #assert_tag with #assert_select.
git-svn-id: http://svn.redmine.org/redmine/trunk@13624 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/repositories_controller_test.rb')
-rw-r--r--test/functional/repositories_controller_test.rb49
1 files changed, 22 insertions, 27 deletions
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index ece5de781..50a0c8676 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -33,7 +33,7 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_template 'new'
assert_kind_of Repository::Subversion, assigns(:repository)
assert assigns(:repository).new_record?
- assert_tag 'input', :attributes => {:name => 'repository[url]', :disabled => nil}
+ assert_select 'input[name=?]:not([disabled])', 'repository[url]'
end
def test_new_should_propose_enabled_scm_only
@@ -44,12 +44,12 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'new'
assert_kind_of Repository::Mercurial, assigns(:repository)
- assert_tag 'select', :attributes => {:name => 'repository_scm'},
- :children => {:count => 3}
- assert_tag 'select', :attributes => {:name => 'repository_scm'},
- :child => {:tag => 'option', :attributes => {:value => 'Mercurial', :selected => 'selected'}}
- assert_tag 'select', :attributes => {:name => 'repository_scm'},
- :child => {:tag => 'option', :attributes => {:value => 'Git', :selected => nil}}
+
+ assert_select 'select[name=repository_scm]' do
+ assert_select 'option', 3
+ assert_select 'option[value=Mercurial][selected=selected]'
+ assert_select 'option[value=Git]:not([selected])'
+ end
end
def test_create
@@ -84,7 +84,7 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_equal Repository.find(11), assigns(:repository)
- assert_tag 'input', :attributes => {:name => 'repository[url]', :value => 'svn://localhost/test', :disabled => 'disabled'}
+ assert_select 'input[name=?][value=?][disabled=disabled]', 'repository[url]', 'svn://localhost/test'
end
def test_update
@@ -170,20 +170,18 @@ class RepositoriesControllerTest < ActionController::TestCase
get :revision, :id => 1, :rev => 1
assert_response :success
- assert_tag 'a', :attributes => {:href => '/projects/ecookbook/repository', :class => /repository/},
- :ancestor => {:attributes => {:id => 'main-menu'}}
+ assert_select '#main-menu a.repository[href=?]', '/projects/ecookbook/repository'
end
def test_revision_with_before_nil_and_afer_normal
get :revision, {:id => 1, :rev => 1}
assert_response :success
assert_template 'revision'
- assert_no_tag :tag => "div", :attributes => { :class => "contextual" },
- :child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/0'}
- }
- assert_tag :tag => "div", :attributes => { :class => "contextual" },
- :child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/2'}
- }
+
+ assert_select 'div.contextual' do
+ assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/0', 0
+ assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2'
+ end
end
def test_add_related_issue
@@ -265,17 +263,14 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'committers'
- assert_tag :td, :content => 'dlopper',
- :sibling => { :tag => 'td',
- :child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} },
- :child => { :tag => 'option', :content => 'Dave Lopper',
- :attributes => { :value => '3', :selected => 'selected' }}}}
- assert_tag :td, :content => 'foo',
- :sibling => { :tag => 'td',
- :child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} }}}
- assert_no_tag :td, :content => 'foo',
- :sibling => { :tag => 'td',
- :descendant => { :tag => 'option', :attributes => { :selected => 'selected' }}}
+ assert_select 'td:content(dlopper) + td select' do
+ assert_select 'option[value="3"][selected=selected]', :text => 'Dave Lopper'
+ end
+
+ assert_select 'td:content(foo) + td select' do
+ assert_select 'option[value=""]'
+ assert_select 'option[selected=selected]', 0 # no option selected
+ end
end
def test_post_committers