diff --git a/app/controllers/statistics_controller.rb b/app/controllers/statistics_controller.rb index 26f80263a..65b3ec906 100644 --- a/app/controllers/statistics_controller.rb +++ b/app/controllers/statistics_controller.rb @@ -11,6 +11,7 @@ class StatisticsController < ApplicationController ] def index + authorize :statistic respond_to do |format| format.html format.json do @@ -76,4 +77,4 @@ class StatisticsController < ApplicationController raise ActiveRecord::RecordNotFound end -end \ No newline at end of file +end diff --git a/spec/policies/statistic_policy_spec.rb b/spec/policies/statistic_policy_spec.rb new file mode 100644 index 000000000..0c0fd2d22 --- /dev/null +++ b/spec/policies/statistic_policy_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +RSpec.describe StatisticPolicy, type: :policy do + subject { described_class } + + permissions :index? do + it "grants access to user" do + expect(subject).to permit(User.new, :statistic) + end + end + +end