Sha256: 55ddfe7676eebcb56513eeb2c4ba2055b247d8d8cc8cead822d8851e94c686b0

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

require 'spec_helper'
require 'seory/condition/path'

describe Seory::Condition::Path do
  let(:controller) { double('controller') }
  let(:path_condition) do
    Seory::Condition::Path.new('/users/alice')
  end

  context 'Accessed to /users/alice (controller: users, action: show, id: alice)' do
    before do
      allow(controller).to receive_message_chain(:request, :fullpath) { '/users/alice' }
    end

    specify { expect(path_condition.match?(controller)).to be_truthy }
  end

  context 'Accessed to /users/bob (controller: users, action: show, id: bob)' do
    before do
      allow(controller).to receive_message_chain(:request, :fullpath) { '/users/bob' }
    end

    specify { expect(path_condition.match?(controller)).to be_falsy }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seory-0.2.0 spec/seory/condition/path_spec.rb
seory-0.1.0 spec/seory/condition/path_spec.rb