Sha256: 1f906b53f3b2ac935ea0f21218dd4f3b33ffbcba2178033ad56fdb115fea33a9
Contents?: true
Size: 1.22 KB
Versions: 5
Compression:
Stored size: 1.22 KB
Contents
require 'spec_helper' module SimpleNavigation describe ItemsProvider do let(:items_provider) { ItemsProvider.new(provider) } describe '#items' do let(:items) { double(:items) } context 'when provider is a symbol' do let(:context) { double(:context, provider_method: items) } let(:provider) { :provider_method } before { SimpleNavigation.stub(context_for_eval: context) } it 'retrieves the items from the evaluation context' do expect(items_provider.items).to eq items end end context 'when provider responds to :items' do let(:provider) { double(:provider, items: items) } it 'retrieves the items from the provider object' do expect(items_provider.items).to eq items end end context 'provider is a collection' do let(:provider) { [] } it 'retrieves the items by returning the provider' do expect(items_provider.items).to eq provider end end context 'when provider is something else' do let(:provider) { double(:provider) } it 'raises an exception' do expect{ items_provider.items }.to raise_error end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems