Sha256: 6c423f993fcd3ccea7372855cd8bc58b28dfa94d38c9f548d9a46ac3bfcfc4f5

Contents?: true

Size: 980 Bytes

Versions: 2

Compression:

Stored size: 980 Bytes

Contents

require 'spec_helper'

class ResourceImplementation
  def self.helper_method(args);end
  include Arpa::Additions::Resource
  def session;'';end
  def current_user;'';end
end

describe Arpa::Additions::Resource, type: :addition, fast: true do

  let(:resource_implementation) { ResourceImplementation.new }

  let(:verifier) { double }
  let(:resource) { double }
  let(:action)   { double }

  before do
    allow(Arpa::Services::Verifier).to receive(:new).and_return(verifier)
    setup
  end

  describe '#has_access?' do

    let(:setup) do
      allow(verifier).to receive(:has_access?)
      resource_implementation.has_access?(resource, action)
    end

    it 'should call :new from Arpa::Services::Verifier' do
      expect(Arpa::Services::Verifier).to have_received(:new).once
    end

    it 'verifier should call :has_access? with resource and action as parameter' do
      expect(verifier).to have_received(:has_access?).with(resource, action).once
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arpa-0.2.0 spec/lib/arpa/additions/resource_spec.rb
arpa-0.1.0 spec/lib/arpa/additions/resource_spec.rb