mirror of
https://github.com/opf/openproject.git
synced 2026-06-15 12:10:09 +00:00
Replace dynamic finder syntax in cuke steps
Signed-off-by: Alex Coles <alex@alexbcoles.com>
This commit is contained in:
@@ -98,7 +98,7 @@ When(/^I call the work_package\-api on project "(.*?)" requesting format "(.*?)"
|
||||
end
|
||||
|
||||
Then(/^I call the work_package\-api on project "(.*?)" requesting format "(.*?)" filtering for type "(.*?)"$/) do |project_name, format, type_names|
|
||||
types = Project.find_by_identifier(project_name).types.where(name: type_names.split(','))
|
||||
types = Project.find_by(identifier: project_name).types.where(name: type_names.split(','))
|
||||
|
||||
get_filtered_json(project_name: project_name,
|
||||
format: format,
|
||||
@@ -120,7 +120,7 @@ When(/^I call the work_package\-api on project "(.*?)" requesting format "(.*?)"
|
||||
end
|
||||
|
||||
And(/^I call the work_package\-api on project "(.*?)" at time "(.*?)" and filter for types "(.*?)"$/) do |project_name, at_time, type_names|
|
||||
types = Project.find_by_identifier(project_name).types.where(name: type_names.split(','))
|
||||
types = Project.find_by(identifier: project_name).types.where(name: type_names.split(','))
|
||||
|
||||
get_filtered_json(project_name: project_name,
|
||||
format: 'json',
|
||||
@@ -131,8 +131,8 @@ And(/^I call the work_package\-api on project "(.*?)" at time "(.*?)" and filter
|
||||
end
|
||||
|
||||
And(/^there are (\d+) work packages of type "(.*?)" in project "(.*?)"$/) do |nr_of_wps, type_name, project_name|
|
||||
project = Project.find_by_identifier(project_name)
|
||||
type = project.types.find_by_name(type_name)
|
||||
project = Project.find_by(identifier: project_name)
|
||||
type = project.types.find_by(name: type_name)
|
||||
|
||||
FactoryGirl.create_list(:work_package, nr_of_wps.to_i, project: project, type: type)
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ Given(/^there is a board "(.*?)" for project "(.*?)"$/) do |board_name, project_
|
||||
end
|
||||
|
||||
Given(/^the board "(.*?)" has the following messages:$/) do |board_name, table|
|
||||
board = Board.find_by_name(board_name)
|
||||
board = Board.find_by(name: board_name)
|
||||
|
||||
create_messages(table.raw.map(&:first), board)
|
||||
end
|
||||
|
||||
Given(/^"(.*?)" has the following replies:$/) do |message_name, table|
|
||||
message = Message.find_by_subject(message_name)
|
||||
message = Message.find_by(subject: message_name)
|
||||
|
||||
create_messages(table.raw.map(&:first), message.board, message)
|
||||
end
|
||||
|
||||
@@ -42,7 +42,7 @@ Given /^the [pP]roject(?: "([^\"]+?)")? uses the following types:$/ do |project,
|
||||
|
||||
types = table.raw.map do |line|
|
||||
name = line.first
|
||||
type = ::Type.find_by_name(name)
|
||||
type = ::Type.find_by(name: name)
|
||||
|
||||
type = FactoryGirl.create(:type, name: name) if type.blank?
|
||||
type
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
Then /^I open the context menu on the work packages:$/ do |table|
|
||||
elements = []
|
||||
table.raw.flatten.each do |subject_or_id|
|
||||
wp = WorkPackage.find_by_subject(subject_or_id) || WorkPackage.find_by_id(subject_or_id)
|
||||
wp = WorkPackage.find_by(subject: subject_or_id) || WorkPackage.find_by(id: subject_or_id)
|
||||
element = page.find(:xpath, "//body//div[@id='content']//tr[@id='work-package-#{wp.id}']")
|
||||
element.find(:css, '.checkbox input').click && elements << element
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#++
|
||||
|
||||
[CustomField, WorkPackageCustomField].each do |const|
|
||||
InstanceFinder.register(const, Proc.new { |name| const.find_by_name(name) })
|
||||
InstanceFinder.register(const, Proc.new { |name| const.find_by(name: name) })
|
||||
RouteMap.register(const, '/custom_fields')
|
||||
end
|
||||
|
||||
@@ -54,8 +54,8 @@ Given /^the following (user|issue|work package) custom fields are defined:$/ do
|
||||
end
|
||||
|
||||
Given /^the user "(.+?)" has the user custom field "(.+?)" set to "(.+?)"$/ do |login, field_name, value|
|
||||
user = User.find_by_login(login)
|
||||
custom_field = UserCustomField.find_by_name(field_name)
|
||||
user = User.find_by(login: login)
|
||||
custom_field = UserCustomField.find_by(name: field_name)
|
||||
|
||||
user.custom_values.build(custom_field: custom_field, value: value)
|
||||
user.save!
|
||||
@@ -77,29 +77,29 @@ Given /^the work package "(.+?)" has the custom field "(.+?)" set to "(.+?)"$/ d
|
||||
end
|
||||
|
||||
Given /^the work package "(.+?)" has the custom user field "(.+?)" set to "(.+?)"$/ do |wp_name, field_name, username|
|
||||
user = User.find_by_login(username)
|
||||
user = User.find_by(login: username)
|
||||
steps %{
|
||||
Given the work package "#{wp_name}" has the custom field "#{field_name}" set to "#{user.id}"
|
||||
}
|
||||
end
|
||||
|
||||
Given(/^the custom field "(.*?)" is enabled for the project "(.*?)"$/) do |field_name, project_name|
|
||||
custom_field = WorkPackageCustomField.find_by_name(field_name)
|
||||
project = Project.find_by_name(project_name)
|
||||
custom_field = WorkPackageCustomField.find_by(name: field_name)
|
||||
project = Project.find_by(name: project_name)
|
||||
|
||||
project.work_package_custom_fields << custom_field
|
||||
project.save!
|
||||
end
|
||||
|
||||
Given(/^the custom field "(.*?)" is disabled for the project "(.*?)"$/) do |field_name, project_name|
|
||||
custom_field = WorkPackageCustomField.find_by_name(field_name)
|
||||
project = Project.find_by_name(project_name)
|
||||
custom_field = WorkPackageCustomField.find_by(name: field_name)
|
||||
project = Project.find_by(name: project_name)
|
||||
|
||||
project.work_package_custom_fields.delete custom_field
|
||||
end
|
||||
|
||||
Given /^the custom field "(.+)" is( not)? summable$/ do |field_name, negative|
|
||||
custom_field = WorkPackageCustomField.find_by_name(field_name)
|
||||
custom_field = WorkPackageCustomField.find_by(name: field_name)
|
||||
|
||||
Setting.work_package_list_summable_columns = negative ?
|
||||
Setting.work_package_list_summable_columns - ["cf_#{custom_field.id}"] :
|
||||
@@ -107,8 +107,8 @@ Given /^the custom field "(.+)" is( not)? summable$/ do |field_name, negative|
|
||||
end
|
||||
|
||||
Given /^the custom field "(.*?)" is activated for type "(.*?)"$/ do |field_name, type_name|
|
||||
custom_field = WorkPackageCustomField.find_by_name(field_name)
|
||||
type = ::Type.find_by_name(type_name)
|
||||
custom_field = WorkPackageCustomField.find_by(name: field_name)
|
||||
type = ::Type.find_by(name: type_name)
|
||||
custom_field.types << type
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ require 'rack_session_access/capybara'
|
||||
|
||||
Before do |scenario|
|
||||
unless ScenarioDisabler.empty_if_disabled(scenario)
|
||||
FactoryGirl.create(:admin) unless User.find_by_login('admin')
|
||||
FactoryGirl.create(:admin) unless User.find_by(login: 'admin')
|
||||
FactoryGirl.create(:anonymous) unless AnonymousUser.count > 0
|
||||
Setting.notified_events = [] # can not test mailer
|
||||
|
||||
@@ -62,19 +62,19 @@ Given /^(?:|I )am not logged in$/ do
|
||||
end
|
||||
|
||||
Given /^(?:|I )am [aA]dmin$/ do
|
||||
admin = User.find_by_admin(true)
|
||||
admin = User.find_by(admin: true)
|
||||
|
||||
login(admin.login, 'adminADMIN!')
|
||||
end
|
||||
|
||||
Given /^(?:|I )am already [aA]dmin$/ do
|
||||
admin = User.find_by_admin(true)
|
||||
admin = User.find_by(admin: true)
|
||||
# see https://github.com/railsware/rack_session_access
|
||||
page.set_rack_session(user_id: admin.id)
|
||||
end
|
||||
|
||||
Given /^I am already logged in as "(.+?)"$/ do |login|
|
||||
user = User.find_by_login(login)
|
||||
user = User.find_by(login: login)
|
||||
# see https://github.com/railsware/rack_session_access
|
||||
page.set_rack_session(user_id: user.id)
|
||||
end
|
||||
@@ -99,7 +99,7 @@ Given /^there is 1 [pP]roject with(?: the following)?:$/ do |table|
|
||||
end
|
||||
|
||||
Then /^the project "([^"]*)" is( not)? public$/ do |project_name, negation|
|
||||
p = Project.find_by_name(project_name)
|
||||
p = Project.find_by(name: project_name)
|
||||
p.update_attribute(:is_public, !negation)
|
||||
end
|
||||
|
||||
@@ -109,21 +109,21 @@ Given /^the plugin (.+) is loaded$/ do |plugin_name|
|
||||
end
|
||||
|
||||
Given /^(?:the )?[pP]roject "([^\"]*)" uses the following [mM]odules:$/ do |project, table|
|
||||
p = Project.find_by_name(project)
|
||||
p = Project.find_by(name: project)
|
||||
|
||||
p.enabled_module_names += table.raw.map(&:first)
|
||||
p.reload
|
||||
end
|
||||
|
||||
Given /^(?:the )?[pP]roject "([^\"]*)" does not use the following [mM]odules:$/ do |project, table|
|
||||
p = Project.find_by_name(project)
|
||||
p = Project.find_by(name: project)
|
||||
|
||||
p.enabled_module_names -= table.raw.map(&:first)
|
||||
p.reload
|
||||
end
|
||||
|
||||
Given /^the [Uu]ser "([^\"]*)" has 1 time [eE]ntry$/ do |user|
|
||||
u = User.find_by_login user
|
||||
u = User.find_by login: user
|
||||
p = u.projects.last
|
||||
raise 'This user must be member of a project to have issues' unless p
|
||||
i = FactoryGirl.create(:work_package, project: p)
|
||||
@@ -137,14 +137,14 @@ Given /^the [Uu]ser "([^\"]*)" has 1 time [eE]ntry$/ do |user|
|
||||
end
|
||||
|
||||
Given /^the [Uu]ser "([^\"]*)" has 1 time entry with (\d+\.?\d*) hours? at the project "([^\"]*)"$/ do |user, hours, project|
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
as_admin do
|
||||
t = TimeEntry.generate
|
||||
i = FactoryGirl.create(:work_package, project: p)
|
||||
t.project = p
|
||||
t.issue = i
|
||||
t.hours = hours.to_f
|
||||
t.user = User.find_by_login user
|
||||
t.user = User.find_by login: user
|
||||
t.activity.project = p
|
||||
t.activity.save!
|
||||
t.save!
|
||||
@@ -152,7 +152,7 @@ Given /^the [Uu]ser "([^\"]*)" has 1 time entry with (\d+\.?\d*) hours? at the p
|
||||
end
|
||||
|
||||
Given /^the [Pp]roject "([^\"]*)" has (\d+) [tT]ime(?: )?[eE]ntr(?:ies|y) with the following:$/ do |project, count, table|
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
as_admin count do
|
||||
t = TimeEntry.generate
|
||||
i = FactoryGirl.create(:work_package, project: p)
|
||||
@@ -162,7 +162,7 @@ Given /^the [Pp]roject "([^\"]*)" has (\d+) [tT]ime(?: )?[eE]ntr(?:ies|y) with t
|
||||
t.activity.save!
|
||||
send_table_to_object(t, table,
|
||||
user: Proc.new do |o, v|
|
||||
o.user = User.find_by_login(v)
|
||||
o.user = User.find_by(login: v)
|
||||
o.save!
|
||||
end,
|
||||
spent_on: Proc.new do |object, value|
|
||||
@@ -177,14 +177,14 @@ Given /^the [Pp]roject "([^\"]*)" has (\d+) [tT]ime(?: )?[eE]ntr(?:ies|y) with t
|
||||
end
|
||||
|
||||
Given /^the [pP]roject "([^\"]*)" has 1 [sS]ubproject$/ do |project|
|
||||
parent = Project.find_by_name(project)
|
||||
parent = Project.find_by(name: project)
|
||||
p = Project.generate
|
||||
p.set_parent!(parent)
|
||||
p.save!
|
||||
end
|
||||
|
||||
Given /^the [pP]roject "([^\"]*)" has 1 [sS]ubproject with the following:$/ do |project, table|
|
||||
parent = Project.find_by_name(project)
|
||||
parent = Project.find_by(name: project)
|
||||
p = FactoryGirl.build(:project)
|
||||
as_admin do
|
||||
send_table_to_object(p, table)
|
||||
@@ -197,7 +197,7 @@ end
|
||||
Given /^there are the following types:$/ do |table|
|
||||
table = table.map_headers { |header| header.underscore.gsub(' ', '_') }
|
||||
table.hashes.each_with_index do |t, i|
|
||||
type = ::Type.find_by_name(t['name'])
|
||||
type = ::Type.find_by(name: t['name'])
|
||||
type = ::Type.new name: t['name'] if type.nil?
|
||||
type.position = t['position'] ? t['position'] : i
|
||||
type.is_in_roadmap = t['is_in_roadmap'] ? t['is_in_roadmap'] : true
|
||||
@@ -212,7 +212,7 @@ end
|
||||
Given /^there are the following issue status:$/ do |table|
|
||||
|
||||
table.hashes.each_with_index do |t, i|
|
||||
status = Status.find_by_name(t['name'])
|
||||
status = Status.find_by(name: t['name'])
|
||||
status = Status.new name: t['name'] if status.nil?
|
||||
status.is_closed = t['is_closed'] == 'true' ? true : false
|
||||
status.is_default = t['is_default'] == 'true' ? true : false
|
||||
@@ -223,8 +223,8 @@ Given /^there are the following issue status:$/ do |table|
|
||||
end
|
||||
|
||||
Given /^the type "(.+?)" has the default workflow for the role "(.+?)"$/ do |type_name, role_name|
|
||||
role = Role.find_by_name(role_name)
|
||||
type = ::Type.find_by_name(type_name)
|
||||
role = Role.find_by(name: role_name)
|
||||
type = ::Type.find_by(name: type_name)
|
||||
type.workflows = []
|
||||
|
||||
Status.all(order: 'id ASC').map(&:id).combination(2).each do |c|
|
||||
@@ -243,7 +243,7 @@ Given /^the [iI]ssue "([^\"]*)" has (\d+) [tT]ime(?: )?[eE]ntr(?:ies|y) with the
|
||||
t.work_package = i
|
||||
send_table_to_object(t, table,
|
||||
user: Proc.new do |o, v|
|
||||
o.user = User.find_by_login(v)
|
||||
o.user = User.find_by(login: v)
|
||||
o.save!
|
||||
end)
|
||||
end
|
||||
@@ -316,7 +316,7 @@ When 'I logout' do
|
||||
end
|
||||
|
||||
Then /^I should be logged in as "([^\"]*)"?$/ do |username|
|
||||
user = User.find_by_login(username) || User.anonymous
|
||||
user = User.find_by(login: username) || User.anonymous
|
||||
page.should have_xpath("//div[contains(., 'Logged in as #{username}')] | //a[contains(.,'#{user.name}')]")
|
||||
|
||||
User.current = user
|
||||
@@ -335,7 +335,7 @@ When /^I satisfy the "(.+)" plugin to (.+)$/ do |plugin_name, action|
|
||||
end
|
||||
|
||||
Given /^I am working in [pP]roject "(.+?)"$/ do |project_name|
|
||||
@project = Project.find_by_name(project_name)
|
||||
@project = Project.find_by(name: project_name)
|
||||
end
|
||||
|
||||
Given /^the [pP]roject uses the following modules:$/ do |table|
|
||||
@@ -344,14 +344,14 @@ end
|
||||
|
||||
Given(/^the user "(.*?)" is responsible$/) do |user|
|
||||
project = get_project
|
||||
project.responsible_id = User.find_by_login(user).id
|
||||
project.responsible_id = User.find_by(login: user).id
|
||||
project.save
|
||||
end
|
||||
|
||||
Given /^the [pP]roject(?: "([^\"]*)")? has the following types:$/ do |project_name, table|
|
||||
p = get_project(project_name)
|
||||
table.hashes.each_with_index do |t, i|
|
||||
type = ::Type.find_by_name(t['name'])
|
||||
type = ::Type.find_by(name: t['name'])
|
||||
type = ::Type.new name: t['name'] if type.nil?
|
||||
type.position = t['position'] ? t['position'] : i
|
||||
type.is_in_roadmap = t['is_in_roadmap'] ? t['is_in_roadmap'] : true
|
||||
@@ -371,7 +371,7 @@ def get_project(project_name = nil)
|
||||
if project_name.blank?
|
||||
project = @project
|
||||
else
|
||||
project = Project.find_by_name(project_name)
|
||||
project = Project.find_by(name: project_name)
|
||||
end
|
||||
if project.nil?
|
||||
if project_name.blank?
|
||||
@@ -450,7 +450,7 @@ end
|
||||
# Do something as admin
|
||||
def as_admin(count = 1)
|
||||
cur_user = User.current
|
||||
User.current = User.find_by_login('admin')
|
||||
User.current = User.find_by(login: 'admin')
|
||||
retval = nil
|
||||
count.to_i.times do
|
||||
retval = yield
|
||||
|
||||
@@ -38,13 +38,13 @@ Given /^the group "(.+)" is a "(.+)" in the project "(.+)"$/ do |group_name, rol
|
||||
end
|
||||
|
||||
Given /^the group "(.+?)" has the following members:$/ do |name, table|
|
||||
group = Group.find_by_lastname(name)
|
||||
group = Group.find_by(lastname: name)
|
||||
|
||||
raise "No group with name #{name} found" unless group.present?
|
||||
|
||||
user_names = table.raw.flatten
|
||||
|
||||
users = User.find_all_by_login(user_names)
|
||||
users = User.where(login: user_names)
|
||||
|
||||
not_found = user_names - users.map(&:login)
|
||||
|
||||
@@ -54,7 +54,7 @@ Given /^the group "(.+?)" has the following members:$/ do |name, table|
|
||||
end
|
||||
|
||||
When /^I add the user "(.+)" to the group$/ do |user_login|
|
||||
user = User.find_by_login!(user_login)
|
||||
user = User.find_by!(login: user_login)
|
||||
|
||||
steps %{
|
||||
When I check "#{user.name}" within "#tab-content-users #users"
|
||||
@@ -70,13 +70,13 @@ Given /^there is a group named "(.*?)" with the following members:$/ do |name, t
|
||||
group = FactoryGirl.create(:group, lastname: name)
|
||||
|
||||
table.raw.flatten.each do |login|
|
||||
group.users << User.find_by_login!(login)
|
||||
group.users << User.find_by!(login: login)
|
||||
end
|
||||
end
|
||||
|
||||
When /^I delete "([^"]*)" from the group$/ do |login|
|
||||
user = User.find_by_login!(login)
|
||||
user = User.find_by!(login: login)
|
||||
step %(I follow "Delete" within "#user-#{user.id}")
|
||||
end
|
||||
|
||||
InstanceFinder.register(Group, Proc.new { |name| Group.find_by_lastname(name) })
|
||||
InstanceFinder.register(Group, Proc.new { |name| Group.find_by(lastname: name) })
|
||||
|
||||
@@ -33,7 +33,7 @@ end
|
||||
|
||||
Given /^the (.+) called "(.+)" has the following localizations:$/ do |model_name, object_name, table|
|
||||
model = model_name.downcase.gsub(/\s/, '_').camelize.constantize
|
||||
object = model.find_by_name(object_name)
|
||||
object = model.find_by(name: object_name)
|
||||
|
||||
object.translations = []
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
# See doc/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
InstanceFinder.register(Category, Proc.new { |name| Category.find_by_name(name) })
|
||||
InstanceFinder.register(Category, Proc.new { |name| Category.find_by(name: name) })
|
||||
|
||||
Given /^the [Pp]roject "([^\"]*)" has (\d+) [cC]ategor(?:ies|y)? with(?: the following)?:$/ do |project, count, table|
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
table.rows_hash['assigned_to'] = Principal.like(table.rows_hash['assigned_to']).first if table.rows_hash['assigned_to']
|
||||
as_admin count do
|
||||
ic = FactoryGirl.build(:category, project: p)
|
||||
@@ -40,7 +40,7 @@ Given /^the [Pp]roject "([^\"]*)" has (\d+) [cC]ategor(?:ies|y)? with(?: the fol
|
||||
end
|
||||
|
||||
Given /^the [Pp]roject "([^\"]*)" has (\d+) [cC]ategor(?:ies|y)?$/ do |project, count|
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
as_admin count do
|
||||
ic = FactoryGirl.build(:category, project: p)
|
||||
ic.save
|
||||
|
||||
@@ -33,12 +33,12 @@ end
|
||||
|
||||
Given /^the issue "(.*?)" is watched by:$/ do |issue_subject, watchers|
|
||||
issue = WorkPackage.find(:last, conditions: { subject: issue_subject }, order: :created_at)
|
||||
watchers.raw.flatten.each { |w| issue.add_watcher User.find_by_login(w) }
|
||||
watchers.raw.flatten.each { |w| issue.add_watcher User.find_by(login: w) }
|
||||
issue.save
|
||||
end
|
||||
|
||||
Then /^the issue "(.*?)" should have (\d+) watchers$/ do |issue_subject, watcher_count|
|
||||
WorkPackage.find_by_subject(issue_subject).watchers.count.should == watcher_count.to_i
|
||||
WorkPackage.find_by(subject: issue_subject).watchers.count.should == watcher_count.to_i
|
||||
end
|
||||
|
||||
Given(/^the issue "(.*?)" has an attachment "(.*?)"$/) do |issue_subject, file_name|
|
||||
@@ -57,7 +57,7 @@ Given(/^the issue "(.*?)" has an attachment "(.*?)"$/) do |issue_subject, file_n
|
||||
end
|
||||
|
||||
Given /^the [Uu]ser "([^\"]*)" has (\d+) [iI]ssue(?:s)? with(?: the following)?:$/ do |user, count, table|
|
||||
u = User.find_by_login user
|
||||
u = User.find_by login: user
|
||||
raise 'This user must be member of a project to have issues' unless u.projects.last
|
||||
as_admin count do
|
||||
i = FactoryGirl.create(:work_package,
|
||||
@@ -66,7 +66,7 @@ Given /^the [Uu]ser "([^\"]*)" has (\d+) [iI]ssue(?:s)? with(?: the following)?:
|
||||
assigned_to: u,
|
||||
status: Status.default || FactoryGirl.create(:status))
|
||||
|
||||
i.type = ::Type.find_by_name(table.rows_hash.delete('type')) if table.rows_hash['type']
|
||||
i.type = ::Type.find_by(name: table.rows_hash.delete('type')) if table.rows_hash['type']
|
||||
|
||||
send_table_to_object(i, table, {}, method(:add_custom_value_to_issue))
|
||||
i.save!
|
||||
@@ -74,7 +74,7 @@ Given /^the [Uu]ser "([^\"]*)" has (\d+) [iI]ssue(?:s)? with(?: the following)?:
|
||||
end
|
||||
|
||||
Given /^the [Pp]roject "([^\"]*)" has (\d+) [iI]ssue(?:s)? with(?: the following)?:$/ do |project, count, table|
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
as_admin count do
|
||||
i = FactoryGirl.build(:work_package, project: p,
|
||||
type: p.types.first)
|
||||
@@ -101,30 +101,30 @@ Given (/^there are the following issues with attributes:$/) do |table|
|
||||
project = get_project(type_attributes.delete('project'))
|
||||
attributes = type_attributes.merge(project_id: project.id) if project
|
||||
|
||||
assignee = User.find_by_login(attributes.delete('assignee'))
|
||||
assignee = User.find_by(login: attributes.delete('assignee'))
|
||||
attributes.merge! assigned_to_id: assignee.id if assignee
|
||||
|
||||
author = User.find_by_login(attributes.delete('author'))
|
||||
author = User.find_by(login: attributes.delete('author'))
|
||||
attributes.merge! author_id: author.id if author
|
||||
|
||||
responsible = User.find_by_login(attributes.delete('responsible'))
|
||||
responsible = User.find_by(login: attributes.delete('responsible'))
|
||||
attributes.merge! responsible_id: responsible.id if responsible
|
||||
|
||||
watchers = attributes.delete('watched_by')
|
||||
|
||||
type = ::Type.find_by_name(attributes.delete('type'))
|
||||
type = ::Type.find_by(name: attributes.delete('type'))
|
||||
attributes.merge! type_id: type.id if type
|
||||
|
||||
version = Version.find_by_name(attributes.delete('version'))
|
||||
version = Version.find_by(name: attributes.delete('version'))
|
||||
attributes.merge! fixed_version_id: version.id if version
|
||||
|
||||
category = Category.find_by_name(attributes.delete('category'))
|
||||
category = Category.find_by(name: attributes.delete('category'))
|
||||
attributes.merge! category_id: category.id if category
|
||||
|
||||
issue = FactoryGirl.create(:work_package, attributes)
|
||||
|
||||
if watchers
|
||||
watchers.split(',').each { |w| issue.add_watcher User.find_by_login(w) }
|
||||
watchers.split(',').each { |w| issue.add_watcher User.find_by(login: w) }
|
||||
issue.save
|
||||
end
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ When /^I activate the ([a-z, ]+) password rules$/ do |rules|
|
||||
end
|
||||
|
||||
def set_user_attribute(login, attribute, value)
|
||||
user = User.find_by_login login
|
||||
user = User.find_by login: login
|
||||
user.send((attribute.to_s + '=').to_sym, value)
|
||||
user.save
|
||||
end
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
#++
|
||||
|
||||
Given /^the principal "(.+)" is a "(.+)" in the project "(.+)"$/ do |principal_name, role_name, project_identifier|
|
||||
project = Project.find_by_identifier(project_identifier)
|
||||
project = Project.find_by(identifier: project_identifier)
|
||||
raise "No project with identifier '#{project_identifier}' found" if project.nil?
|
||||
|
||||
role = Role.find_by_name(role_name)
|
||||
role = Role.find_by(name: role_name)
|
||||
raise "No role with name '#{role_name}' found" if role.nil?
|
||||
|
||||
principal = InstanceFinder.find(Principal, principal_name)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# See doc/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
InstanceFinder.register(IssuePriority, Proc.new { |name| IssuePriority.find_by_name(name) })
|
||||
InstanceFinder.register(IssuePriority, Proc.new { |name| IssuePriority.find_by(name: name) })
|
||||
|
||||
Given /^there is a(?:n)? (default )?issuepriority with:$/ do |default, table|
|
||||
name = table.raw.select { |ary| ary.include? 'name' }.first[table.raw.first.index('name') + 1].to_s
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#++
|
||||
|
||||
When /^I check the role "(.+?)" for the project member "(.+?)"$/ do |role_name, user_login|
|
||||
role = Role.find_by_name(role_name)
|
||||
role = Role.find_by(name: role_name)
|
||||
|
||||
member = member_for_login user_login
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Given /^there is a project named "([^"]*)"(?: of type "([^"]*)")?$/ do |name, pr
|
||||
identifier: name.downcase.gsub(' ', '_') }
|
||||
|
||||
if project_type_name
|
||||
attributes.merge!(project_type: ProjectType.find_by_name!(project_type_name))
|
||||
attributes.merge!(project_type: ProjectType.find_by!(name: project_type_name))
|
||||
end
|
||||
|
||||
FactoryGirl.create(:project, attributes)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# See doc/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
InstanceFinder.register(ProjectType, Proc.new { |name| ProjectType.find_by_name(name) })
|
||||
InstanceFinder.register(ProjectType, Proc.new { |name| ProjectType.find_by(name: name) })
|
||||
|
||||
Given /^the project(?: named "([^"]*)")? has no project type$/ do |name|
|
||||
project = get_project(name)
|
||||
@@ -35,13 +35,13 @@ Given /^the project(?: named "([^"]*)")? has no project type$/ do |name|
|
||||
end
|
||||
|
||||
Given /^the project(?: named "([^"]*)")? is of the type "([^"]*)"$/ do |name, type_name|
|
||||
type_id = ProjectType.select(:id).find_by_name(type_name).id
|
||||
type_id = ProjectType.select(:id).find_by(name: type_name).id
|
||||
project = get_project(name)
|
||||
project.update_attribute(:project_type_id, type_id)
|
||||
end
|
||||
|
||||
When /^I follow the edit link of the project type "([^"]*)"$/ do |project_type_name|
|
||||
type = ProjectType.find_by_name(project_type_name)
|
||||
type = ProjectType.find_by(name: project_type_name)
|
||||
|
||||
href = Rails.application.routes.url_helpers.edit_project_type_path(type)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#++
|
||||
|
||||
Given /^the [Pp]roject "([^\"]*)" has (\d+) [wW]ork [pP]ackage [qQ]uer(?:ies|y)? with(?: the following)?:$/ do |project, count, table|
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
as_admin count do
|
||||
i = FactoryGirl.build(:query, project: p)
|
||||
send_table_to_object(i, table)
|
||||
@@ -37,7 +37,7 @@ Given /^the [Pp]roject "([^\"]*)" has (\d+) [wW]ork [pP]ackage [qQ]uer(?:ies|y)?
|
||||
end
|
||||
|
||||
Given /^the [Pp]roject "([^\"]*)" has (\d+) [wW]ork [pP]ackage [qQ]uer(?:ies|y)?$/ do |project, count|
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
as_admin count do
|
||||
i = FactoryGirl.build(:query, project: p)
|
||||
i.save
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
#++
|
||||
|
||||
Given /^the [Uu]ser "([^\"]*)" is a "([^\"]*)" (?:in|of) the [Pp]roject "([^\"]*)"$/ do |user, role, project|
|
||||
u = User.find_by_login(user)
|
||||
r = Role.find_by_name(role)
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
u = User.find_by(login: user)
|
||||
r = Role.find_by(name: role)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
as_admin do
|
||||
Member.new.tap do |m|
|
||||
m.user = u
|
||||
@@ -41,21 +41,21 @@ Given /^the [Uu]ser "([^\"]*)" is a "([^\"]*)" (?:in|of) the [Pp]roject "([^\"]*
|
||||
end
|
||||
|
||||
Given /^there is a [rR]ole "([^\"]*)"$/ do |name, _table = Cucumber::Ast::Table.new([])|
|
||||
FactoryGirl.create(:role, name: name) unless Role.find_by_name(name)
|
||||
FactoryGirl.create(:role, name: name) unless Role.find_by(name: name)
|
||||
end
|
||||
|
||||
Given /^there is a [rR]ole "([^\"]*)" with the following permissions:?$/ do |name, table|
|
||||
FactoryGirl.create(:role, name: name, permissions: table.raw.flatten) unless Role.find_by_name(name)
|
||||
FactoryGirl.create(:role, name: name, permissions: table.raw.flatten) unless Role.find_by(name: name)
|
||||
end
|
||||
|
||||
Given /^there are the following roles:$/ do |table|
|
||||
table.raw.flatten.each do |name|
|
||||
FactoryGirl.create(:role, name: name) unless Role.find_by_name(name)
|
||||
FactoryGirl.create(:role, name: name) unless Role.find_by(name: name)
|
||||
end
|
||||
end
|
||||
|
||||
Given /^the [rR]ole "([^\"]*)" may have the following [rR]ights:$/ do |role, table|
|
||||
r = Role.find_by_name(role)
|
||||
r = Role.find_by(name: role)
|
||||
raise "No such role was defined: #{role}" unless r
|
||||
as_admin do
|
||||
available_perms = Redmine::AccessControl.permissions.map(&:name)
|
||||
@@ -76,7 +76,7 @@ Given /^the [rR]ole "([^\"]*)" may have the following [rR]ights:$/ do |role, tab
|
||||
end
|
||||
|
||||
Given /^the [rR]ole "(.+?)" has no (?:[Pp]ermissions|[Rr]ights)$/ do |role_name|
|
||||
role = Role.find_by_name(role_name)
|
||||
role = Role.find_by(name: role_name)
|
||||
raise "No such role was defined: #{role_name}" unless role
|
||||
as_admin do
|
||||
role.permissions = []
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
Given /^there is a(?:n)? (default )?(?:issue)?status with:$/ do |default, table|
|
||||
name = table.raw.select { |ary| ary.include? 'name' }.first[table.raw.first.index('name') + 1].to_s
|
||||
Status.find_by_name(name) || Status.create(name: name.to_s, is_default: !!default)
|
||||
Status.find_by(name: name) || Status.create(name: name.to_s, is_default: !!default)
|
||||
end
|
||||
|
||||
Given /^there are the following status:$/ do |table|
|
||||
@@ -41,4 +41,4 @@ Given /^there are the following status:$/ do |table|
|
||||
end
|
||||
end
|
||||
|
||||
InstanceFinder.register(Status, Proc.new { |name| Status.find_by_name(name) })
|
||||
InstanceFinder.register(Status, Proc.new { |name| Status.find_by(name: name) })
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#++
|
||||
|
||||
Given(/^there is a time entry for "(.*?)" with (\d+) hours$/) do |subject, hours|
|
||||
work_package = WorkPackage.find_by_subject(subject)
|
||||
work_package = WorkPackage.find_by(subject: subject)
|
||||
time_entry = FactoryGirl.create(:time_entry, work_package: work_package, hours: hours, project: work_package.project)
|
||||
end
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Given(/^the work package "(.*?)" was changed "(.*?)" to:$/) do |name, time, tabl
|
||||
|
||||
Timecop.freeze(target_time) do
|
||||
|
||||
timeline = WorkPackage.find_by_subject(name)
|
||||
timeline = WorkPackage.find_by(subject: name)
|
||||
table.hashes.first.each do | key, value |
|
||||
timeline[key] = value
|
||||
end
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#++
|
||||
|
||||
Given /^the [pP]roject "([^\"]*)" has the parent "([^\"]*)"$/ do |child_name, parent_name|
|
||||
parent = Project.find_by_name(parent_name)
|
||||
child = Project.find_by_name(child_name)
|
||||
parent = Project.find_by(name: parent_name)
|
||||
child = Project.find_by(name: child_name)
|
||||
|
||||
child.set_parent!(parent)
|
||||
child.save!
|
||||
@@ -44,7 +44,7 @@ Given /^there are the following colors:$/ do |table|
|
||||
end
|
||||
|
||||
Given /^I am working in the [tT]imeline "([^"]*)" of the project called "([^"]*)"$/ do |timeline_name, project_name|
|
||||
@project = Project.find_by_name(project_name)
|
||||
@project = Project.find_by(name: project_name)
|
||||
@timeline_name = timeline_name
|
||||
end
|
||||
|
||||
@@ -73,8 +73,8 @@ end
|
||||
Given /^there are the following project associations:$/ do |table|
|
||||
table = table.map_headers { |h| h.delete(' ').underscore }
|
||||
|
||||
table.map_column!('project_a') { |name| Project.find_by_name!(name) }
|
||||
table.map_column!('project_b') { |name| Project.find_by_name!(name) }
|
||||
table.map_column!('project_a') { |name| Project.find_by!(name: name) }
|
||||
table.map_column!('project_b') { |name| Project.find_by!(name: name) }
|
||||
|
||||
table.hashes.each do |type_attributes|
|
||||
FactoryGirl.create(:project_association, type_attributes)
|
||||
@@ -85,14 +85,14 @@ Given /^there are the following reportings:$/ do |table|
|
||||
table = table.map_headers { |h| h.delete(' ').underscore }
|
||||
|
||||
table.hashes.each do |attrs|
|
||||
attrs['project'] = Project.find_by_name!(attrs['project'])
|
||||
attrs['reporting_to_project'] = Project.find_by_name!(attrs['reporting_to_project'])
|
||||
attrs['project'] = Project.find_by!(name: attrs['project'])
|
||||
attrs['reporting_to_project'] = Project.find_by!(name: attrs['reporting_to_project'])
|
||||
FactoryGirl.create(:reporting, attrs)
|
||||
end
|
||||
end
|
||||
|
||||
Given /^there is a timeline "([^"]*)" for project "([^"]*)"$/ do |timeline_name, project_name|
|
||||
project = Project.find_by_name(project_name)
|
||||
project = Project.find_by(name: project_name)
|
||||
|
||||
timeline = FactoryGirl.create(:timeline, project_id: project.id, name: timeline_name)
|
||||
timeline.options = { 'initial_outline_expansion' => ['6'], 'timeframe_end' => '', 'timeframe_start' => '', 'zoom_factor' => ['-1'], 'exist' => '' }
|
||||
@@ -100,10 +100,10 @@ Given /^there is a timeline "([^"]*)" for project "([^"]*)"$/ do |timeline_name,
|
||||
end
|
||||
|
||||
Given /^the following types are enabled for projects of type "(.*?)"$/ do |project_type_name, type_name_table|
|
||||
project_type = ProjectType.find_by_name(project_type_name)
|
||||
project_type = ProjectType.find_by(name: project_type_name)
|
||||
projects = Project.where(project_type_id: project_type.id)
|
||||
types = type_name_table.raw.flatten.map do |type_name|
|
||||
::Type.find_by_name(type_name) || FactoryGirl.create(:type, name: type_name)
|
||||
::Type.find_by(name: type_name) || FactoryGirl.create(:type, name: type_name)
|
||||
end
|
||||
|
||||
projects.each do |project|
|
||||
|
||||
@@ -220,7 +220,7 @@ Then(/^I should not be able to add new project associations$/) do
|
||||
end
|
||||
|
||||
Then(/^I should (not )?see a planning element link for "([^"]*)"$/) do |negate, planning_element_subject|
|
||||
planning_element = PlanningElement.find_by_subject(planning_element_subject)
|
||||
planning_element = PlanningElement.find_by(subject: planning_element_subject)
|
||||
text = "*#{planning_element.id}"
|
||||
|
||||
step %{I should #{negate}see "#{text}"}
|
||||
@@ -228,7 +228,7 @@ end
|
||||
|
||||
Then(/^I should (not )?see the timeline "([^"]*)"$/) do |negate, timeline_name|
|
||||
selector = 'div.timeline div.tl-left-main'
|
||||
timeline = Timeline.find_by_name(timeline_name)
|
||||
timeline = Timeline.find_by(name: timeline_name)
|
||||
|
||||
if (negate && page.has_css?(selector)) || !negate
|
||||
timeline.project.work_packages.each do |work_package|
|
||||
|
||||
@@ -54,7 +54,7 @@ When (/^I make the planning element "([^"]*?)" vertical for the timeline "([^"]*
|
||||
steps %{
|
||||
When I go to the edit page of the timeline "#{timeline_name}" of the project called "#{project_name}"
|
||||
}
|
||||
planning_element = PlanningElement.find_by_subject(planning_element_subject)
|
||||
planning_element = PlanningElement.find_by(subject: planning_element_subject)
|
||||
|
||||
page.should have_selector('#timeline_options_vertical_planning_elements', visible: false)
|
||||
|
||||
@@ -96,7 +96,7 @@ When (/^I set the first level grouping criteria to "(.*?)" for the timeline "(.*
|
||||
steps %{
|
||||
When I go to the edit page of the timeline "#{timeline_name}" of the project called "#{project_name}"
|
||||
}
|
||||
grouping_project = Project.find_by_name(grouping_project_name)
|
||||
grouping_project = Project.find_by(name: grouping_project_name)
|
||||
|
||||
page.should have_selector('#timeline_options_grouping_one_enabled', visible: false)
|
||||
|
||||
@@ -120,7 +120,7 @@ When (/^I show only work packages which have the responsible "(.*?)"$/) do |resp
|
||||
When I edit the settings of the current timeline
|
||||
}
|
||||
|
||||
responsible = User.find_by_login(responsible)
|
||||
responsible = User.find_by(login: responsible)
|
||||
page.execute_script(<<-JavaScript)
|
||||
jQuery('#timeline_options_planning_element_responsibles').val('#{responsible.id}')
|
||||
jQuery('#content form').submit()
|
||||
@@ -143,7 +143,7 @@ When (/^I show only work packages which have the type "(.*?)"$/) do |type|
|
||||
When I edit the settings of the current timeline
|
||||
}
|
||||
|
||||
type = ::Type.find_by_name(type)
|
||||
type = ::Type.find_by(name: type)
|
||||
page.execute_script(<<-JavaScript)
|
||||
jQuery('#timeline_options_planning_element_types').val('#{type.id}')
|
||||
jQuery('#content form').submit()
|
||||
@@ -157,7 +157,7 @@ When (/^I show only projects which have responsible set to "(.*?)"$/) do |respon
|
||||
|
||||
page.should have_selector('#timeline_options_project_responsibles', visible: false)
|
||||
|
||||
responsible = User.find_by_login(responsible)
|
||||
responsible = User.find_by(login: responsible)
|
||||
page.execute_script("jQuery('#timeline_options_project_responsibles').val('#{responsible.id}')")
|
||||
page.execute_script("jQuery('#content form').submit()")
|
||||
end
|
||||
@@ -169,7 +169,7 @@ When (/^I show only projects which have a planning element which lies between "(
|
||||
|
||||
page.should have_selector('#timeline_options_planning_element_time_types', visible: false)
|
||||
|
||||
type = ::Type.find_by_name(type)
|
||||
type = ::Type.find_by(name: type)
|
||||
page.execute_script("jQuery('#timeline_options_planning_element_time_types').val('#{type.id}')")
|
||||
page.execute_script("jQuery('#timeline_options_planning_element_time_absolute').prop('checked', true)")
|
||||
page.execute_script("jQuery('#timeline_options_planning_element_time_absolute_one').val('#{start_date}')")
|
||||
@@ -181,7 +181,7 @@ When (/^I set the second level grouping criteria to "(.*?)" for the timeline "(.
|
||||
steps %{
|
||||
When I go to the edit page of the timeline "#{timeline_name}" of the project called "#{project_name}"
|
||||
}
|
||||
project_type = ProjectType.find_by_name(project_type_name)
|
||||
project_type = ProjectType.find_by(name: project_type_name)
|
||||
|
||||
page.should have_selector('#timeline_options_grouping_two_enabled', visible: false)
|
||||
|
||||
@@ -218,7 +218,7 @@ When (/^I set the first level grouping criteria to:$/) do |table|
|
||||
table.raw.each do |_perm|
|
||||
perm = _perm.first
|
||||
unless perm.blank?
|
||||
result.push(Project.find_by_name(perm).id)
|
||||
result.push(Project.find_by(name: perm).id)
|
||||
end
|
||||
end
|
||||
results = result.join(',')
|
||||
@@ -288,14 +288,14 @@ When (/^I move "([^"]*)" down by one$/) do |name|
|
||||
end
|
||||
|
||||
When (/^I fill in a wiki macro for timeline "([^"]*)" for "([^"]*)"$/) do |timeline_name, container|
|
||||
timeline = Timeline.find_by_name(timeline_name)
|
||||
timeline = Timeline.find_by(name: timeline_name)
|
||||
|
||||
text = "{{timeline(#{timeline.id})}}"
|
||||
step %{I fill in "#{text}" for "#{container}"}
|
||||
end
|
||||
|
||||
When (/^(.*) for the color "([^"]*)"$/) do |step_name, color_name|
|
||||
color = PlanningElementTypeColor.find_by_name(color_name)
|
||||
color = PlanningElementTypeColor.find_by(name: color_name)
|
||||
|
||||
step %{#{step_name} within "#color-#{color.id} td:first-child"}
|
||||
end
|
||||
|
||||
@@ -29,16 +29,16 @@
|
||||
|
||||
# change from symbol to constant once namespace is removed
|
||||
|
||||
InstanceFinder.register(::Type, Proc.new { |name| ::Type.find_by_name(name) })
|
||||
InstanceFinder.register(::Type, Proc.new { |name| ::Type.find_by(name: name) })
|
||||
|
||||
RouteMap.register(::Type, '/types')
|
||||
|
||||
Given /^the following types are enabled for the project called "(.*?)":$/ do |project_name, type_name_table|
|
||||
types = type_name_table.raw.flatten.map do |type_name|
|
||||
::Type.find_by_name(type_name) || FactoryGirl.create(:type, name: type_name)
|
||||
::Type.find_by(name: type_name) || FactoryGirl.create(:type, name: type_name)
|
||||
end
|
||||
|
||||
project = Project.find_by_identifier(project_name)
|
||||
project = Project.find_by(identifier: project_name)
|
||||
project.types = types
|
||||
project.save!
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# See doc/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
InstanceFinder.register(User, Proc.new { |name| User.find_by_login(name) })
|
||||
InstanceFinder.register(User, Proc.new { |name| User.find_by(login: name) })
|
||||
|
||||
##
|
||||
# Editing/creating users (admin UI)
|
||||
@@ -43,7 +43,7 @@ When /^I create a new user$/ do
|
||||
end
|
||||
|
||||
When /^I edit the user "([^\"]*)"$/ do |user|
|
||||
user_id = User.find_by_login(user).id
|
||||
user_id = User.find_by(login: user).id
|
||||
visit "/users/#{user_id}/edit"
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ end
|
||||
#
|
||||
Given /^there is 1 [Uu]ser with(?: the following)?:$/ do |table|
|
||||
login = table.rows_hash[:Login].to_s + table.rows_hash[:login].to_s
|
||||
user = User.find_by_login(login) unless login.blank?
|
||||
user = User.find_by(login: login) unless login.blank?
|
||||
|
||||
if !user
|
||||
user = FactoryGirl.create(:user)
|
||||
@@ -82,27 +82,27 @@ Given /^there is 1 [Uu]ser with(?: the following)?:$/ do |table|
|
||||
end
|
||||
|
||||
Given /^the [Uu]ser "([^\"]*)" has:$/ do |user, table|
|
||||
u = User.find_by_login(user)
|
||||
u = User.find_by(login: user)
|
||||
raise "No such user: #{user}" unless u
|
||||
modify_user(u, table)
|
||||
end
|
||||
|
||||
Given /^the [Uu]ser "([^\"]*)" has the following preferences$/ do |user, table|
|
||||
u = User.find_by_login(user)
|
||||
u = User.find_by(login: user)
|
||||
|
||||
send_table_to_object(u.pref, table)
|
||||
end
|
||||
|
||||
Given /^the user "([^\"]*)" is locked$/ do |user|
|
||||
User.find_by_login(user).lock!
|
||||
User.find_by(login: user).lock!
|
||||
end
|
||||
|
||||
Given /^the user "([^\"]*)" is registered and not activated$/ do |user|
|
||||
User.find_by_login(user).register!
|
||||
User.find_by(login: user).register!
|
||||
end
|
||||
|
||||
Given /^the user "([^\"]*)" had too many recently failed logins$/ do |user|
|
||||
user = User.find_by_login(user)
|
||||
user = User.find_by(login: user)
|
||||
user.failed_login_count = 100
|
||||
user.last_failed_login_on = Time.now
|
||||
user.save
|
||||
@@ -124,7 +124,7 @@ end
|
||||
Then /^there should be a user with the following:$/ do |table|
|
||||
expected = table.rows_hash
|
||||
|
||||
user = User.find_by_login(expected['login'])
|
||||
user = User.find_by(login: expected['login'])
|
||||
|
||||
user.should_not be_nil
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
# See doc/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
InstanceFinder.register(Version, Proc.new { |name| Version.find_by_name(name) })
|
||||
InstanceFinder.register(Version, Proc.new { |name| Version.find_by(name: name) })
|
||||
|
||||
Given /^the [Pp]roject (.+) has 1 version with(?: the following)?:$/ do |project, table|
|
||||
project.gsub!("\"", '')
|
||||
p = Project.find_by_name(project) || Project.find_by_identifier(project)
|
||||
p = Project.find_by(name: project) || Project.find_by(identifier: project)
|
||||
|
||||
as_admin do
|
||||
v = FactoryGirl.build(:version) do |v|
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
#++
|
||||
|
||||
Given /^the wiki menu item of the wiki page "(.*?)" of project "(.*?)" has been deleted$/ do |item_name, project_name|
|
||||
project = Project.find_by_name project_name
|
||||
project = Project.find_by name: project_name
|
||||
WikiPage.where(title: item_name, wiki_id: project.wiki.id).first.delete_wiki_menu_item
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#++
|
||||
|
||||
Given /^the [Pp]roject "([^\"]*)" has 1 [wW]iki(?: )?[pP]age with the following:$/ do |project, table|
|
||||
p = Project.find_by_name(project)
|
||||
p = Project.find_by(name: project)
|
||||
|
||||
p.wiki = Wiki.create unless p.wiki
|
||||
|
||||
@@ -45,37 +45,37 @@ end
|
||||
Given /^the project "(.*?)" has (?:1|a) wiki menu item with the following:$/ do |project_name, table|
|
||||
item = FactoryGirl.build(:wiki_menu_item)
|
||||
send_table_to_object(item, table)
|
||||
item.wiki = Project.find_by_name(project_name).wiki
|
||||
item.wiki = Project.find_by(name: project_name).wiki
|
||||
item.save!
|
||||
end
|
||||
|
||||
Given /^the project "(.*?)" has a child wiki page of "(.*?)" with the following:$/ do |project_name, parent_page_title, table|
|
||||
wiki = Project.find_by_name(project_name).wiki
|
||||
wiki = Project.find_by(name: project_name).wiki
|
||||
wikipage = FactoryGirl.build(:wiki_page, wiki: wiki)
|
||||
|
||||
send_table_to_object(wikipage, table)
|
||||
|
||||
FactoryGirl.create(:wiki_content, page: wikipage)
|
||||
|
||||
parent_page = WikiPage.find_by_wiki_id_and_title(wiki.id, parent_page_title)
|
||||
parent_page = WikiPage.find_by(wiki_id: wiki.id, title: parent_page_title)
|
||||
wikipage.parent_id = parent_page.id
|
||||
wikipage.save!
|
||||
end
|
||||
|
||||
Then /^the table of contents wiki menu item inside the "(.*?)" menu item should be selected$/ do |parent_item_name|
|
||||
parent_item = MenuItems::WikiMenuItem.find_by_title(parent_item_name)
|
||||
parent_item = MenuItems::WikiMenuItem.find_by(title: parent_item_name)
|
||||
|
||||
page.should have_css(".#{parent_item.item_class}-toc-menu-item.selected")
|
||||
end
|
||||
|
||||
Then /^the child page wiki menu item inside the "(.*?)" menu item should be selected$/ do |parent_item_name|
|
||||
parent_item = MenuItems::WikiMenuItem.find_by_title(parent_item_name)
|
||||
parent_item = MenuItems::WikiMenuItem.find_by(title: parent_item_name)
|
||||
|
||||
page.should have_css(".#{parent_item.item_class}-new-page-menu-item.selected")
|
||||
end
|
||||
|
||||
Given /^the wiki page "([^"]*)" of the project "([^"]*)" has the following contents:$/ do |page, project, table|
|
||||
project = Project.find_by_name project
|
||||
project = Project.find_by name: project
|
||||
wiki = project.wiki || Wiki.create
|
||||
wp = wiki.pages.find_or_create_by_title(page)
|
||||
wc = wp.content || wp.create_content
|
||||
@@ -83,7 +83,7 @@ Given /^the wiki page "([^"]*)" of the project "([^"]*)" has the following conte
|
||||
end
|
||||
|
||||
Given /^the wiki page "([^"]*)" of the project "([^"]*)" has (\d+) versions{0,1}$/ do |page, project, version_count|
|
||||
project = Project.find_by_name project
|
||||
project = Project.find_by name: project
|
||||
wiki = project.wiki
|
||||
wp = wiki.pages.find_or_create_by_title(page)
|
||||
wp.save! unless wp.persisted?
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#++
|
||||
|
||||
Given(/^the work package "(.*?)" has the following changesets:$/) do |subject, table|
|
||||
wp = WorkPackage.find_by_subject!(subject)
|
||||
wp = WorkPackage.find_by!(subject: subject)
|
||||
|
||||
repo = wp.project.repository
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ When (/^I fill in a (\d+) hash(?:es)? quickinfo link to "([^"]*)" for "([^"]*)"$
|
||||
|
||||
raise 'Only values between 1 and 3 are allowed for hashes' if count < 1 || count > 3
|
||||
|
||||
work_package = WorkPackage.find_by_subject(subject)
|
||||
work_package = WorkPackage.find_by(subject: subject)
|
||||
text = "#{('#' * count)}#{work_package.id}"
|
||||
|
||||
step %{I fill in "#{text}" for "#{container}"}
|
||||
@@ -42,7 +42,7 @@ When (/^I follow the (\d+) hash(?:es)? work package quickinfo link to "([^"]*)"$
|
||||
count = count.to_i
|
||||
raise 'Only values between 1 and 3 are allowed for hashes' if count < 1 || count > 3
|
||||
|
||||
work_package = WorkPackage.find_by_subject(subject)
|
||||
work_package = WorkPackage.find_by(subject: subject)
|
||||
|
||||
text = case count
|
||||
when 1
|
||||
@@ -58,7 +58,7 @@ Then /^I should (not )?see a (\d+) hash(?:es)? work package quickinfo link to "(
|
||||
count = count.to_i
|
||||
raise 'Only values between 1 and 3 are allowed for hashes' if count < 1 || count > 3
|
||||
|
||||
work_package = WorkPackage.find_by_subject(subject)
|
||||
work_package = WorkPackage.find_by(subject: subject)
|
||||
|
||||
expectation = negate ? :should_not : :should
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
|
||||
require 'rack_session_access/capybara'
|
||||
|
||||
InstanceFinder.register(WorkPackage, Proc.new { |name| WorkPackage.find_by_subject(name) })
|
||||
InstanceFinder.register(WorkPackage, Proc.new { |name| WorkPackage.find_by(subject: name) })
|
||||
RouteMap.register(WorkPackage, '/work_packages')
|
||||
|
||||
Given /^the work package "(.*?)" has the following children:$/ do |work_package_subject, table|
|
||||
parent = WorkPackage.find_by_subject(work_package_subject)
|
||||
parent = WorkPackage.find_by(subject: work_package_subject)
|
||||
|
||||
table.raw.flatten.each do |child_subject|
|
||||
child = WorkPackage.find_by_subject(child_subject)
|
||||
child = WorkPackage.find_by(subject: child_subject)
|
||||
|
||||
child.parent_id = parent.id
|
||||
|
||||
@@ -45,46 +45,46 @@ Given /^the work package "(.*?)" has the following children:$/ do |work_package_
|
||||
end
|
||||
|
||||
Given /^a relation between "(.*?)" and "(.*?)"$/ do |work_package_from, work_package_to|
|
||||
from = WorkPackage.find_by_subject(work_package_from)
|
||||
to = WorkPackage.find_by_subject(work_package_to)
|
||||
from = WorkPackage.find_by(subject: work_package_from)
|
||||
to = WorkPackage.find_by(subject: work_package_to)
|
||||
|
||||
FactoryGirl.create :relation, from: from, to: to
|
||||
end
|
||||
|
||||
Given /^user is already watching "(.*?)"$/ do |work_package_subject|
|
||||
work_package = WorkPackage.find_by_subject(work_package_subject)
|
||||
work_package = WorkPackage.find_by(subject: work_package_subject)
|
||||
user = User.find(page.get_rack_session['user_id'])
|
||||
|
||||
work_package.add_watcher user
|
||||
end
|
||||
|
||||
Given(/^the work_package "(.+?)" is updated with the following:$/) do |subject, table|
|
||||
work_package = WorkPackage.find_by_subject(subject)
|
||||
work_package = WorkPackage.find_by(subject: subject)
|
||||
except = {}
|
||||
|
||||
except['type'] = lambda { |wp, value| wp.type = ::Type.find_by_name(value) if value }
|
||||
except['assigned_to'] = lambda { |wp, value| wp.assigned_to = User.find_by_login(value) if value }
|
||||
except['responsible'] = lambda { |wp, value| wp.responsible = User.find_by_login(value) if value }
|
||||
except['type'] = lambda { |wp, value| wp.type = ::Type.find_by(name: value) if value }
|
||||
except['assigned_to'] = lambda { |wp, value| wp.assigned_to = User.find_by(login: value) if value }
|
||||
except['responsible'] = lambda { |wp, value| wp.responsible = User.find_by(login: value) if value }
|
||||
|
||||
send_table_to_object(work_package, table, except)
|
||||
end
|
||||
|
||||
Given(/^the user "([^\"]+)" has the following queries by type in the project "(.*?)":$/) do |login, project_name, table|
|
||||
u = User.find_by_login login
|
||||
u = User.find_by login: login
|
||||
p = get_project(project_name)
|
||||
|
||||
table.hashes.each_with_index do |t, _i|
|
||||
types = ::Type.find_all_by_name(t['type_value']).map { |type| type.id.to_s }
|
||||
types = ::Type.where(name: t['type_value']).map { |type| type.id.to_s }
|
||||
p.queries.create(user_id: u.id, name: t['name'], filters: [Queries::WorkPackages::Filter.new(:type_id, operator: '=', values: types)])
|
||||
end
|
||||
end
|
||||
|
||||
Given(/^the user "([^\"]+)" has the following query menu items in the project "(.*?)":$/) do |login, project_name, table|
|
||||
u = User.find_by_login login
|
||||
u = User.find_by login: login
|
||||
p = get_project(project_name)
|
||||
|
||||
table.hashes.each_with_index do |t, _i|
|
||||
query = p.queries.find_by_name t['navigatable']
|
||||
query = p.queries.find_by name: t['navigatable']
|
||||
MenuItems::QueryMenuItem.create name: t['name'], title: t['title'], navigatable_id: query.id
|
||||
end
|
||||
end
|
||||
@@ -141,7 +141,7 @@ Then /^the work package should be shown with the following values:$/ do |table|
|
||||
end
|
||||
|
||||
Then(/^the attribute "(.*?)" of work package "(.*?)" should be "(.*?)"$/) do |attribute, wp_name, value|
|
||||
wp = WorkPackage.find_by_subject(wp_name)
|
||||
wp = WorkPackage.find_by(subject: wp_name)
|
||||
wp ||= WorkPackages.where('subject like ?', wp_name).to_sql
|
||||
wp.send(attribute).to_s.should == value
|
||||
end
|
||||
|
||||
+35
-35
@@ -53,7 +53,7 @@ module NavigationHelpers
|
||||
project_identifier = $2.gsub("\"", '')
|
||||
tab.gsub("\"", '')
|
||||
|
||||
project_identifier = Project.find_by_name(project_identifier).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_identifier).identifier.gsub(' ', '%20')
|
||||
|
||||
if tab == ''
|
||||
"/projects/#{project_identifier}/settings"
|
||||
@@ -64,7 +64,7 @@ module NavigationHelpers
|
||||
when /^the [wW]iki [pP]age "([^\"]+)" (?:for|of) the project called "([^\"]+)"$/
|
||||
wiki_page = Wiki.titleize($1)
|
||||
project_identifier = $2.gsub("\"", '')
|
||||
project = Project.find_by_name(project_identifier)
|
||||
project = Project.find_by(name: project_identifier)
|
||||
project_identifier = project.identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}/wiki/#{wiki_page}"
|
||||
|
||||
@@ -80,16 +80,16 @@ module NavigationHelpers
|
||||
when /^the edit menu item page of the [wW]iki [pP]age "([^\"]+)" (?:for|of) the project called "([^\"]+)"$/
|
||||
wiki_page = Wiki.titleize($1)
|
||||
project_identifier = $2.gsub("\"", '')
|
||||
project = Project.find_by_name(project_identifier)
|
||||
project = Project.find_by(name: project_identifier)
|
||||
project_identifier = project.identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}/wiki/#{wiki_page}/wiki_menu_item/edit"
|
||||
|
||||
when /^the [cC]ost [rR]eports page (?:of|for) the project called "([^\"]+)" without filters or groups$/
|
||||
project_identifier = Project.find_by_name($1).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: $1).identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}/cost_reports?set_filter=1"
|
||||
|
||||
when /^the [cC]ost [rR]eports page (?:of|for) the project called "([^\"]+)"$/
|
||||
project_identifier = Project.find_by_name($1).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: $1).identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}/cost_reports"
|
||||
|
||||
when /^the overall [cC]ost [rR]eports page$/
|
||||
@@ -109,37 +109,37 @@ module NavigationHelpers
|
||||
|
||||
when /^the (?:(?:overview |home ?))?page (?:for|of) the project(?: called)? "(.+)"$/
|
||||
project_identifier = $1.gsub("\"", '')
|
||||
project_identifier = Project.find_by_name(project_identifier).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_identifier).identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}"
|
||||
|
||||
when /^the activity page of the project(?: called)? "(.+)"$/
|
||||
project_identifier = $1.gsub("\"", '')
|
||||
project_identifier = Project.find_by_name(project_identifier).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_identifier).identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}/activity"
|
||||
|
||||
when /^the overall activity page$/
|
||||
'/activity'
|
||||
|
||||
when /^the page (?:for|of) the issue "([^\"]+)"$/
|
||||
issue = WorkPackage.find_by_subject($1)
|
||||
issue = WorkPackage.find_by(subject: $1)
|
||||
"/work_packages/#{issue.id}"
|
||||
|
||||
when /^the edit page (?:for|of) the issue "([^\"]+)"$/
|
||||
issue = WorkPackage.find_by_subject($1)
|
||||
issue = WorkPackage.find_by(subject: $1)
|
||||
"/issues/#{issue.id}/edit"
|
||||
|
||||
when /^the copy page (?:for|of) the work package "([^\"]+)"$/
|
||||
package = WorkPackage.find_by_subject($1)
|
||||
package = WorkPackage.find_by(subject: $1)
|
||||
project = package.project
|
||||
"/projects/#{project.identifier}/work_packages/new?copy_from=#{package.id}"
|
||||
|
||||
when /^the work packages? index page (?:for|of) (the)? project(?: called)? (.+)$/
|
||||
project_identifier = $2.gsub("\"", '')
|
||||
project_identifier = Project.find_by_name(project_identifier).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_identifier).identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}/work_packages"
|
||||
|
||||
when /^the page (?:for|of) the work package(?: called)? "([^\"]+)"$/
|
||||
work_package = WorkPackage.find_by_subject($1)
|
||||
work_package = WorkPackage.find_by(subject: $1)
|
||||
"/work_packages/#{work_package.id}"
|
||||
|
||||
when /^the new work_package page (?:for|of) the project called "([^\"]+)"$/
|
||||
@@ -151,7 +151,7 @@ module NavigationHelpers
|
||||
when /^the wiki index page(?: below the (.+) page)? (?:for|of) (?:the)? project(?: called)? (.+)$/
|
||||
parent_page_title, project_identifier = $1, $2
|
||||
project_identifier.gsub!("\"", '')
|
||||
project_identifier = Project.find_by_name(project_identifier).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_identifier).identifier.gsub(' ', '%20')
|
||||
|
||||
if parent_page_title.present?
|
||||
parent_page_title.gsub!("\"", '')
|
||||
@@ -165,13 +165,13 @@ module NavigationHelpers
|
||||
parent_page_title, project_identifier = $1, $2
|
||||
project_identifier.gsub!("\"", '')
|
||||
parent_page_title.gsub!("\"", '')
|
||||
project_identifier = Project.find_by_name(project_identifier).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_identifier).identifier.gsub(' ', '%20')
|
||||
|
||||
"/projects/#{project_identifier}/wiki/#{parent_page_title}/new"
|
||||
|
||||
when /^the edit page (?:for |of )(the )?role(?: called)? (.+)$/
|
||||
role_identifier = $2.gsub("\"", '')
|
||||
role_identifier = Role.find_by_name(role_identifier).id
|
||||
role_identifier = Role.find_by(name: role_identifier).id
|
||||
"/roles/edit/#{role_identifier}"
|
||||
|
||||
when /^the new user page$/
|
||||
@@ -179,18 +179,18 @@ module NavigationHelpers
|
||||
|
||||
when /^the edit page (?:for |of )(the )?user(?: called)? (.+)$/
|
||||
user_identifier = $2.gsub("\"", '')
|
||||
user_identifier = User.find_by_login(user_identifier).id
|
||||
user_identifier = User.find_by(login: user_identifier).id
|
||||
"/users/#{user_identifier}/edit"
|
||||
|
||||
when /^the (.+) tab of the edit page (?:for |of )(the )?user(?: called)? (.+)$/
|
||||
tab = $1
|
||||
user_identifier = $3.gsub("\"", '')
|
||||
user_identifier = User.find_by_login(user_identifier).id
|
||||
user_identifier = User.find_by(login: user_identifier).id
|
||||
"/users/#{user_identifier}/edit/#{tab}"
|
||||
|
||||
when /^the show page (?:for |of )(the )?user(?: called)? (.+)$/
|
||||
user_identifier = $2.gsub("\"", '')
|
||||
user_identifier = User.find_by_login(user_identifier).id
|
||||
user_identifier = User.find_by(login: user_identifier).id
|
||||
"/users/#{user_identifier}"
|
||||
|
||||
when /^the index page (?:for|of) users$/
|
||||
@@ -201,7 +201,7 @@ module NavigationHelpers
|
||||
|
||||
when /^the edit page (?:for |of )the version(?: called) (.+)$/
|
||||
version_name = $1.gsub("\"", '')
|
||||
version = Version.find_by_name(version_name)
|
||||
version = Version.find_by(name: version_name)
|
||||
"/versions/edit/#{version.id}"
|
||||
|
||||
# this should be handled by the generic "the edit page of ..." path
|
||||
@@ -247,7 +247,7 @@ module NavigationHelpers
|
||||
selection = $2.dup
|
||||
name.gsub!("\"", '')
|
||||
selection.gsub!("\"", '')
|
||||
u = User.find_by_login(name)
|
||||
u = User.find_by(login: name)
|
||||
"/account/#{u.id}/activate?#{selection}"
|
||||
|
||||
when /^the My page$/
|
||||
@@ -300,7 +300,7 @@ module NavigationHelpers
|
||||
when /the page of the timeline(?: "([^\"]+)")? of the project called "([^\"]+)"$/
|
||||
timeline_name = $1
|
||||
project_name = $2
|
||||
project = Project.find_by_name(project_name)
|
||||
project = Project.find_by(name: project_name)
|
||||
project_identifier = project.identifier.gsub(' ', '%20')
|
||||
timeline = project.timelines.detect { |t| t.name == timeline_name }
|
||||
|
||||
@@ -312,27 +312,27 @@ module NavigationHelpers
|
||||
|
||||
when /the new timeline page of the project called "([^\"]+)"$/
|
||||
project_name = $1
|
||||
project_identifier = Project.find_by_name(project_name).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_name).identifier.gsub(' ', '%20')
|
||||
|
||||
"/projects/#{project_identifier}/timelines/new"
|
||||
|
||||
when /the edit page of the timeline "([^\"]+)" of the project called "([^\"]+)"$/
|
||||
timeline_name = $1
|
||||
project_name = $2
|
||||
project_identifier = Project.find_by_name(project_name).identifier.gsub(' ', '%20')
|
||||
timeline = Timeline.find_by_name(timeline_name)
|
||||
project_identifier = Project.find_by(name: project_name).identifier.gsub(' ', '%20')
|
||||
timeline = Timeline.find_by(name: timeline_name)
|
||||
"/projects/#{project_identifier}/timelines/#{timeline.id}/edit"
|
||||
|
||||
when /^the page of the planning element "([^\"]+)" of the project called "([^\"]+)"$/
|
||||
planning_element_name = $1
|
||||
planning_element = WorkPackage.find_by_subject(planning_element_name)
|
||||
planning_element = WorkPackage.find_by(subject: planning_element_name)
|
||||
"/work_packages/#{planning_element.id}"
|
||||
|
||||
when /^the (.+) page (?:for|of) the project called "([^\"]+)"$/
|
||||
project_page = $1
|
||||
project_identifier = $2.gsub("\"", '')
|
||||
project_page = project_page.gsub(' ', '').underscore
|
||||
project_identifier = Project.find_by_name(project_identifier).identifier.gsub(' ', '%20')
|
||||
project_identifier = Project.find_by(name: project_identifier).identifier.gsub(' ', '%20')
|
||||
"/projects/#{project_identifier}/#{project_page}"
|
||||
|
||||
when /^the quick reference for wiki syntax$/
|
||||
@@ -345,39 +345,39 @@ module NavigationHelpers
|
||||
"/settings/plugin/#{$1}"
|
||||
|
||||
when /^the admin page of the group called "([^"]*)"$/
|
||||
id = Group.find_by_lastname!($1).id
|
||||
id = Group.find_by!(lastname: $1).id
|
||||
"/admin/groups/#{id}/edit"
|
||||
|
||||
when /^the time entry page of issue "(.+)"$/
|
||||
issue_id = WorkPackage.find_by_subject($1).id
|
||||
issue_id = WorkPackage.find_by(subject: $1).id
|
||||
"/work_packages/#{issue_id}/time_entries"
|
||||
|
||||
when /^the time entry report page of issue "(.+)"$/
|
||||
issue_id = WorkPackage.find_by_subject($1).id
|
||||
issue_id = WorkPackage.find_by(subject: $1).id
|
||||
"/work_packages/#{issue_id}/time_entries/report"
|
||||
|
||||
when /^the move new page of the work package "(.+)"$/
|
||||
work_package_id = WorkPackage.find_by_subject($1).id
|
||||
work_package_id = WorkPackage.find_by(subject: $1).id
|
||||
"/work_packages/#{work_package_id}/move/new?copy="
|
||||
|
||||
when /^the applied query "([^\"]+)" on the work packages index page of the project "([^\"]+)"$/
|
||||
project = Project.find_by_name($2)
|
||||
query = project.queries.find_by_name($1)
|
||||
project = Project.find_by(name: $2)
|
||||
query = project.queries.find_by(name: $1)
|
||||
project_work_packages_path project, query_id: query.id
|
||||
|
||||
when /^the move page of the work package "(.+)"$/
|
||||
work_package_id = WorkPackage.find_by_subject($1).id
|
||||
work_package_id = WorkPackage.find_by(subject: $1).id
|
||||
"/work_packages/#{work_package_id}/move/new"
|
||||
|
||||
when /^the message page of message "(.+)"$/
|
||||
message = Message.find_by_subject($1)
|
||||
message = Message.find_by(subject: $1)
|
||||
topic_path(message)
|
||||
|
||||
# Add more mappings here.
|
||||
# Here is an example that pulls values out of the Regexp:
|
||||
#
|
||||
# when /^(.*)'s profile page$/i
|
||||
# user_profile_path(User.find_by_login($1))
|
||||
# user_profile_path(User.find_by(login: $1))
|
||||
else
|
||||
begin
|
||||
page_name =~ /^the (.*) page$/
|
||||
|
||||
Reference in New Issue
Block a user