Commit e072a274 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add missing specs for request aware entity module

[ci skip]
parent 468b47d4
...@@ -2,14 +2,11 @@ module RequestAwareEntity ...@@ -2,14 +2,11 @@ module RequestAwareEntity
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
include Gitlab::Routing.url_helpers include Gitlab::Routing
include Gitlab::Allowable
end end
def request def request
@options.fetch(:request) options.fetch(:request)
end
def can?(object, action, subject)
Ability.allowed?(object, action, subject)
end end
end end
require 'spec_helper'
describe RequestAwareEntity do
subject do
Class.new.include(described_class).new
end
it 'includes URL helpers' do
expect(subject).to respond_to(:namespace_project_path)
end
it 'includes method for checking abilities' do
expect(subject).to respond_to(:can?)
end
it 'fetches request from options' do
expect(subject).to receive(:options)
.and_return({request: 'some value'})
expect(subject.request).to eq 'some value'
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment