##// END OF EJS Templates
Rails3: test: fix ordering functional/comments_controller_test.rb...
Rails3: test: fix ordering functional/comments_controller_test.rb On Rails 3.0.11, test fails. <pre> Failure: <"This is a test comment"> expected but was <"my first comment">. test_add_comment(CommentsControllerTest) test/functional/comments_controller_test.rb:34:in `test_add_comment' </pre> Contributed by Sylvain Utard. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8987 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r3964:41f8d043eb29
r8867:b7ead65fde0f
Show More
object_daddy_helpers.rb
40 lines | 1.1 KiB | text/x-ruby | RubyLexer
/ test / object_daddy_helpers.rb
module ObjectDaddyHelpers
# TODO: Remove these three once everyone has ported their code to use the
# new object_daddy version with protected attribute support
def User.generate_with_protected(attributes={})
User.generate(attributes)
end
def User.generate_with_protected!(attributes={})
User.generate!(attributes)
end
def User.spawn_with_protected(attributes={})
User.spawn(attributes)
end
def User.add_to_project(user, project, roles)
roles = [roles] unless roles.is_a?(Array)
Member.generate!(:principal => user, :project => project, :roles => roles)
end
# Generate the default Query
def Query.generate_default!(attributes={})
query = Query.spawn(attributes)
query.name ||= '_'
query.save!
query
end
# Generate an issue for a project, using it's trackers
def Issue.generate_for_project!(project, attributes={})
issue = Issue.spawn(attributes) do |issue|
issue.project = project
issue.tracker = project.trackers.first unless project.trackers.empty?
yield issue if block_given?
end
issue.save!
issue
end
end