Removed some shoulda context.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11864 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2013-05-18 09:14:10 +00:00
1 parent 8f7b69f77e
commit 474c010746
4 files changed
+68 -120

No files matched your search

+15 -21
View File
@@ -35,30 +35,24 @@ class ApplicationHelperTest < ActionView::TestCase
set_tmp_attachments_directory
end
context "#link_to_if_authorized" do
context "for authorized user" do
should "allow using the :controller and :action for the target link" do
User.current = User.find_by_login('admin')
test "#link_to_if_authorized for authorized user should allow using the :controller and :action for the target link" do
User.current = User.find_by_login('admin')
@project = Issue.first.project # Used by helper
response = link_to_if_authorized('By controller/actionr',
{:controller => 'issues', :action => 'edit', :id => Issue.first.id})
assert_match /href/, response
end
end
@project = Issue.first.project # Used by helper
response = link_to_if_authorized('By controller/actionr',
{:controller => 'issues', :action => 'edit', :id => Issue.first.id})
assert_match /href/, response
end
context "for unauthorized user" do
should "display nothing if user isn't authorized" do
User.current = User.find_by_login('dlopper')
@project = Project.find('private-child')
issue = @project.issues.first
assert !issue.visible?
test "#link_to_if_authorized for unauthorized user should display nothing if user isn't authorized" do
User.current = User.find_by_login('dlopper')
@project = Project.find('private-child')
issue = @project.issues.first
assert !issue.visible?
response = link_to_if_authorized('Never displayed',
{:controller => 'issues', :action => 'show', :id => issue})
assert_nil response
end
end
response = link_to_if_authorized('Never displayed',
{:controller => 'issues', :action => 'show', :id => issue})
assert_nil response
end
def test_auto_links
+18 -34
View File
@@ -91,55 +91,39 @@ class RoleTest < ActiveSupport::TestCase
assert_equal Role.all.reject(&:builtin?).sort, Role.find_all_givable
end
context "#anonymous" do
should "return the anonymous role" do
def test_anonymous_should_return_the_anonymous_role
assert_no_difference('Role.count') do
role = Role.anonymous
assert role.builtin?
assert_equal Role::BUILTIN_ANONYMOUS, role.builtin
end
end
context "with a missing anonymous role" do
setup do
Role.delete_all("builtin = #{Role::BUILTIN_ANONYMOUS}")
end
def test_anonymous_with_a_missing_anonymous_role_should_return_the_anonymous_role
Role.where(:builtin => Role::BUILTIN_ANONYMOUS).delete_all
should "create a new anonymous role" do
assert_difference('Role.count') do
Role.anonymous
end
end
should "return the anonymous role" do
role = Role.anonymous
assert role.builtin?
assert_equal Role::BUILTIN_ANONYMOUS, role.builtin
end
assert_difference('Role.count') do
role = Role.anonymous
assert role.builtin?
assert_equal Role::BUILTIN_ANONYMOUS, role.builtin
end
end
context "#non_member" do
should "return the non-member role" do
def test_non_member_should_return_the_non_member_role
assert_no_difference('Role.count') do
role = Role.non_member
assert role.builtin?
assert_equal Role::BUILTIN_NON_MEMBER, role.builtin
end
end
context "with a missing non-member role" do
setup do
Role.delete_all("builtin = #{Role::BUILTIN_NON_MEMBER}")
end
def test_non_member_with_a_missing_non_member_role_should_return_the_non_member_role
Role.where(:builtin => Role::BUILTIN_NON_MEMBER).delete_all
should "create a new non-member role" do
assert_difference('Role.count') do
Role.non_member
end
end
should "return the non-member role" do
role = Role.non_member
assert role.builtin?
assert_equal Role::BUILTIN_NON_MEMBER, role.builtin
end
assert_difference('Role.count') do
role = Role.non_member
assert role.builtin?
assert_equal Role::BUILTIN_NON_MEMBER, role.builtin
end
end
end
+11 -15
View File
@@ -84,22 +84,18 @@ class WikiTest < ActiveSupport::TestCase
assert_equal ja_test, Wiki.titleize(ja_test)
end
context "#sidebar" do
setup do
@wiki = Wiki.find(1)
end
def test_sidebar_should_return_nil_if_undefined
@wiki = Wiki.find(1)
assert_nil @wiki.sidebar
end
should "return nil if undefined" do
assert_nil @wiki.sidebar
end
def test_sidebar_should_return_a_wiki_page_if_defined
@wiki = Wiki.find(1)
page = @wiki.pages.new(:title => 'Sidebar')
page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
page.save!
should "return a WikiPage if defined" do
page = @wiki.pages.new(:title => 'Sidebar')
page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
page.save!
assert_kind_of WikiPage, @wiki.sidebar
assert_equal 'Sidebar', @wiki.sidebar.title
end
assert_kind_of WikiPage, @wiki.sidebar
assert_equal 'Sidebar', @wiki.sidebar.title
end
end