Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions app/contracts/custom_fields/base_contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ module CustomFields
class BaseContract < ::ModelContract
include RequiresAdminGuard

attribute :admin_only
attribute :allow_non_open_versions
attribute :content_right_to_left
attribute :custom_field_section_id
attribute :default_value
attribute :editable
attribute :type
attribute :field_format
attribute :formula
attribute :is_filter
attribute :is_for_all
attribute :is_required do
validate_non_true_for_some_formats
end
attribute :max_length
attribute :min_length
attribute :multi_value
attribute :name
attribute :possible_values
attribute :regexp
attribute :formula
attribute :searchable
attribute :admin_only
attribute :default_value
attribute :multi_value
attribute :content_right_to_left
attribute :custom_field_section_id
attribute :allow_non_open_versions
attribute :type

def validate_non_true_for_some_formats
return unless %w[bool calculated_value].include?(field_format)
Expand Down
2 changes: 1 addition & 1 deletion app/models/calculated_value_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CalculatedValueError < ApplicationRecord
ERROR_DISABLED_VALUE].freeze

validates :customized, presence: true
validates :custom_field_id, presence: true
validates :custom_field, presence: true

validates :error_code, inclusion: { in: VALID_ERROR_CODES }

Expand Down
6 changes: 3 additions & 3 deletions lib/open_project/custom_field_format_dependent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class CustomFieldFormatDependent
defaultBool: [:only, %w[bool]],
defaultLongText: [:only, %w[text]],
defaultText: [:except, %w[list bool date text user version hierarchy calculated_value]],
enterpriseBanner: [:only, %w[hierarchy]],
formula: [:only, %w[calculated_value]],
length: [:except, %w[list bool date user version link hierarchy calculated_value]],
multiSelect: [:only, %w[list user version hierarchy]],
possibleValues: [:only, %w[list]],
regexp: [:except, %w[list bool date user version hierarchy calculated_value]],
formula: [:only, %w[calculated_value]],
searchable: [:except, %w[bool date float int user version hierarchy calculated_value]],
textOrientation: [:only, %w[text]],
enterpriseBanner: [:only, %w[hierarchy]]
textOrientation: [:only, %w[text]]
}.freeze

def self.stimulus_config
Expand Down
2 changes: 1 addition & 1 deletion lib/open_project/mutex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def with_advisory_lock_transaction(entry, suffix = nil, options = {}, &)
end

def with_advisory_lock(resource_class, lock_name, options = {})
debug_log("Attempting to fetched advisory lock", lock_name)
debug_log("Attempting to fetch advisory lock", lock_name)
result = resource_class.with_advisory_lock(lock_name, options) do
debug_log("Fetched advisory lock", lock_name)
yield
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# ++

RSpec.shared_examples_for "list custom fields" do |type|
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }
let(:user) { create(:admin) }

current_user { user }
Expand Down Expand Up @@ -94,7 +94,7 @@
end

RSpec.shared_examples_for "hierarchy custom fields on index page" do |type|
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }
let(:user) { create(:admin) }

current_user { user }
Expand Down Expand Up @@ -126,7 +126,7 @@
end

RSpec.shared_examples_for "expected fields for the custom field's format" do |type, format|
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }
let(:user) { create(:admin) }

current_user { user }
Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/custom_fields/time_entries/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
RSpec.describe "List custom fields edit", :js do
shared_let(:admin) { create(:admin) }

let(:index_cf_page) { Pages::CustomFields::IndexPage.new }
let(:new_cf_page) { Pages::CustomFields::NewPage.new }
let(:index_cf_page) { Pages::CustomFields::Index.new }
let(:new_cf_page) { Pages::CustomFields::New.new }

current_user { admin }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
# ++

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "custom fields", :js do
shared_let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }

current_user { user }

Expand Down
3 changes: 1 addition & 2 deletions spec/features/admin/custom_fields/work_packages/date_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
# ++

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "custom fields", :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }

current_user { user }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
# ++

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "custom fields", :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }

current_user { user }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

RSpec.describe "work package custom fields of type hierarchy", :js do
shared_let(:admin) { create(:admin) }
let(:custom_field_index_page) { Pages::CustomFields::IndexPage.new }
let(:new_custom_field_page) { Pages::CustomFields::NewPage.new }
let(:hierarchy_page) { Pages::CustomFields::HierarchyPage.new }
let(:custom_field_index_page) { Pages::CustomFields::Index.new }
let(:new_custom_field_page) { Pages::CustomFields::New.new }
let(:hierarchy_page) { Pages::CustomFields::Hierarchy.new }

current_user { admin }

Expand Down
3 changes: 1 addition & 2 deletions spec/features/admin/custom_fields/work_packages/int_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
# ++

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "custom fields", :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }

current_user { user }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

RSpec.describe "Link custom fields edit", :js do
shared_let(:admin) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }

current_user { admin }

Expand Down
3 changes: 1 addition & 2 deletions spec/features/admin/custom_fields/work_packages/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
# ++

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "work package list custom fields", :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }

before do
login_as user
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# frozen_string_literal: true

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "custom fields", :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }
let(:editor) { Components::WysiwygEditor.new "#custom_field_form" }
let(:type) { create(:type_task) }
let!(:project) { create(:project, enabled_module_names: %i[work_package_tracking], types: [type]) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
RSpec.describe "Multi-value custom fields creation", :js, :selenium do
shared_let(:admin) { create(:admin) }

let(:index_cf_page) { Pages::CustomFields::IndexPage.new }
let(:index_cf_page) { Pages::CustomFields::Index.new }

current_user { admin }

Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/custom_fields/work_packages/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

RSpec.describe "User custom fields edit", :js do
shared_let(:admin) { create(:admin) }
let(:index_cf_page) { Pages::CustomFields::IndexPage.new }
let(:new_cf_page) { Pages::CustomFields::NewPage.new }
let(:index_cf_page) { Pages::CustomFields::Index.new }
let(:new_cf_page) { Pages::CustomFields::New.new }

current_user { admin }

Expand Down
3 changes: 1 addition & 2 deletions spec/features/custom_fields/activate_in_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
#++

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "custom fields", :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }
let(:for_all_cf) { create(:list_wp_custom_field, is_for_all: true) }
let(:project_specific_cf) { create(:integer_wp_custom_field) }
let(:work_package) do
Expand Down
3 changes: 1 addition & 2 deletions spec/features/custom_fields/reorder_options_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "spec_helper"
require "support/pages/custom_fields/index_page"

def get_possible_values(amount)
(1..amount).to_a.map { |x| "PREFIX #{x}" }
Expand All @@ -17,7 +16,7 @@ def get_possible_values_reordered(amount)

RSpec.describe "Reordering custom options of a list custom field", :js, :selenium do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields::IndexPage.new }
let(:cf_page) { Pages::CustomFields::Index.new }

let!(:custom_field) do
create(
Expand Down
1 change: 0 additions & 1 deletion spec/features/types/activate_in_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#++

require "spec_helper"
require "support/pages/custom_fields/index_page"

RSpec.describe "types", :js do
let(:user) do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users/password_change_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
end

context "as a user on his my page" do
let(:user_page) { Pages::My::PasswordPage.new }
let(:user_page) { Pages::My::Password.new }
let(:third_password) { "third_Password!123" }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/calculated_value_error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

describe "validations" do
it { is_expected.to validate_presence_of(:customized) }
it { is_expected.to validate_presence_of(:custom_field_id) }
it { is_expected.to validate_presence_of(:custom_field) }

it "validates uniqueness of customized scoped to custom_field_id and error_code" do
# Create an initial record
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
# See COPYRIGHT and LICENSE files for more details.
#++

require "support/pages/custom_fields/index_page"
require "support/pages/custom_fields/index"

module Pages
module Admin
module Settings
module ProjectCustomFields
class Index < ::Pages::CustomFields::IndexPage
class Index < ::Pages::CustomFields::Index
def path
"/admin/settings/project_custom_fields"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

module Pages
module CustomFields
class HierarchyPage < Page
class Hierarchy < Page
def path
case @tab
when "items"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

module Pages
module CustomFields
class IndexPage < Page
class Index < Page
def path
"/custom_fields"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

module Pages
module CustomFields
class NewPage < Page
class New < Page
def path
"/custom_fields/new?type=#{@type}"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

module Pages
module My
class PasswordPage < ::Pages::Page
class Password < ::Pages::Page
def path
"/my/password"
end
Expand Down
Loading