#465: Added specs for StatisticPolicy
This commit is contained in:
parent
0c35d117fa
commit
f2d3b3cbd4
|
@ -11,6 +11,7 @@ class StatisticsController < ApplicationController
|
||||||
]
|
]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
authorize :statistic
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.json do
|
format.json do
|
||||||
|
@ -76,4 +77,4 @@ class StatisticsController < ApplicationController
|
||||||
raise ActiveRecord::RecordNotFound
|
raise ActiveRecord::RecordNotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue