changes to enabled modules already tracked by core (#265)

[ci skip]
pull/6827/head
ulferts 7 years ago committed by Oliver Günther
parent 5039f4efbc
commit e325e83f0f
  1. 8
      lib/open_project/backlogs/engine.rb
  2. 25
      spec/api/work_packages/work_package_schema_representer_spec.rb

@ -231,14 +231,6 @@ module OpenProject::Backlogs
add_api_attribute on: :work_package, ar_name: :story_points
add_api_attribute on: :work_package, ar_name: :remaining_hours, writeable: ->(*) { model.leaf? }
add_api_representer_cache_key(:v3, :work_packages, :schema, :work_package_schema) do
if represented.project.module_enabled?('backlogs')
['backlogs_enabled']
else
['backlogs_not_enabled']
end
end
add_api_path :backlogs_type do |id|
# There is no api endpoint for this url
"#{root}/backlogs_types/#{id}"

@ -129,29 +129,4 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do
end
end
end
describe '#cache_key' do
def joined_cache_key
representer.cache_key.join('/')
end
before do
allow(work_package.project)
.to receive(:module_enabled?)
.and_return false
original_cache_key
end
let(:original_cache_key) { joined_cache_key }
it 'changes depending on whether costs is enabled or not' do
allow(work_package.project)
.to receive(:module_enabled?)
.with('backlogs')
.and_return true
expect(joined_cache_key).to_not eql(original_cache_key)
end
end
end

Loading…
Cancel
Save