From f2d3b3cbd421b6e623a4cb748a8c974c35266850 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 14 Apr 2015 00:10:22 +0300 Subject: [PATCH] #465: Added specs for StatisticPolicy --- app/controllers/statistics_controller.rb | 3 ++- spec/policies/statistic_policy_spec.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 spec/policies/statistic_policy_spec.rb 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