Adapt to enforced current_user in representers

pull/6827/head
Jan Sandbrink 9 years ago
parent 5268a54a49
commit 4d40c029ee
  1. 3
      lib/api/v3/budgets/budgets_by_project_api.rb
  2. 2
      lib/api/v3/cost_entries/aggregated_cost_entry_representer.rb
  3. 3
      lib/api/v3/cost_entries/cost_entries_by_work_package_api.rb
  4. 2
      spec/lib/api/v3/budgets/budget_representer_spec.rb
  5. 2
      spec/lib/api/v3/cost_entries/cost_entry_representer_spec.rb
  6. 2
      spec/lib/api/v3/cost_types/cost_type_representer_spec.rb

@ -40,7 +40,8 @@ module API
get do
BudgetCollectionRepresenter.new(@budgets,
@budgets.count,
api_v3_paths.budgets_by_project(@project.id))
api_v3_paths.budgets_by_project(@project.id),
current_user: current_user)
end
end
end

@ -27,7 +27,7 @@ module API
@cost_type = cost_type
@spent_units = units
super(nil)
super(nil, current_user: nil)
end
linked_property :cost_type,

@ -45,7 +45,8 @@ module API
cost_entries = @cost_helper.cost_entries
CostEntryCollectionRepresenter.new(cost_entries,
cost_entries.count,
path)
path,
current_user: current_user)
end
end

@ -35,7 +35,7 @@ describe ::API::V3::Budgets::BudgetRepresenter do
updated_on: Date.today)
}
let(:representer) { described_class.new(budget) }
let(:representer) { described_class.new(budget, current_user: user) }
context 'generation' do
subject(:generated) { representer.to_json }

@ -23,7 +23,7 @@ describe ::API::V3::CostEntries::CostEntryRepresenter do
include API::V3::Utilities::PathHelper
let(:cost_entry) { FactoryGirl.build(:cost_entry, id: 42) }
let(:representer) { described_class.new(cost_entry) }
let(:representer) { described_class.new(cost_entry, current_user: double('current_user')) }
subject { representer.to_json }

@ -23,7 +23,7 @@ describe ::API::V3::CostTypes::CostTypeRepresenter do
include API::V3::Utilities::PathHelper
let(:cost_type) { FactoryGirl.build_stubbed(:cost_type) }
let(:representer) { described_class.new(cost_type) }
let(:representer) { described_class.new(cost_type, current_user: double('current_user')) }
subject { representer.to_json }

Loading…
Cancel
Save