Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix create project spec

Oliver Günther8bc7915200b4
diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb
index 34806b7e975..494767196ad 100644
--- a/app/assets/javascripts/application.js.erb
+++ b/app/assets/javascripts/application.js.erb
@@ -165,8 +165,7 @@ function observeProjectName() {
function observeProjectIdentifier() {
jQuery('#project_identifier').keyup(function() {
- if(jQuery('#project_identifier').getValue() !== '' &&
- jQuery('#project_identifier').getValue() != generateProjectIdentifier()) {
+ if(this.value !== '' && this.value != generateProjectIdentifier()) {
projectIdentifierLocked = true;
} else {
projectIdentifierLocked = false;
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index b54d7cd7141..2519f86f05e 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -81,7 +81,7 @@ class ProjectsController < ApplicationController
def create
call_result =
- if params[:from_template]
+ if params[:from_template].present?
create_from_template
else
create_from_params
@@ -89,6 +89,7 @@ class ProjectsController < ApplicationController
# In success case, nothing to do
call_result.on_failure do
+ @project = call_result.result
@errors = call_result.errors
assign_default_create_variables
diff --git a/spec/features/projects/project_status_administration_spec.rb b/spec/features/projects/project_status_administration_spec.rb
index e27be61170c..c7c2e727666 100644
--- a/spec/features/projects/project_status_administration_spec.rb
+++ b/spec/features/projects/project_status_administration_spec.rb
@@ -45,8 +45,8 @@ describe 'Projects status administration', type: :feature, js: true do
.and_return(r.id.to_s)
end
end
- let(:create_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(5)') }
- let(:edit_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(6)') }
+ let(:create_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(6)') }
+ let(:edit_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(7)') }
before do
login_as current_user
diff --git a/spec/features/projects/projects_spec.rb b/spec/features/projects/projects_spec.rb
index adf9292cd24..169b2dd8ef2 100644
--- a/spec/features/projects/projects_spec.rb
+++ b/spec/features/projects/projects_spec.rb
@@ -48,6 +48,8 @@ describe 'Projects', type: :feature do
fill_in 'project[name]', with: 'Foo bar'
click_on 'Advanced settings'
fill_in 'project[identifier]', with: 'foo'
+ sleep 1
+
click_on 'Create'
expect(page).to have_content 'Successful creation.'
@@ -63,6 +65,7 @@ describe 'Projects', type: :feature do
fill_in 'project[name]', with: 'Foo bar'
click_on 'Advanced settings'
fill_in 'project[identifier]', with: 'foo'
+ sleep 1
click_on 'Create'
expect(page).to have_content 'Successful creation.'