Sha256: 6c8caa3209c808480448e067f4bc224bd361774ea876028d87ab3f688203922b
Contents?: true
Size: 1.21 KB
Versions: 20
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' require_relative '../../../lib/locomotive/steam/adapters/filesystem.rb' require_relative '../../../lib/locomotive/steam/adapters/mongodb.rb' describe Locomotive::Steam::SnippetRepository do shared_examples_for 'a repository' do let(:site) { Locomotive::Steam::Site.new(_id: site_id, locales: %w(en fr nb)) } let(:locale) { :en } let(:repository) { described_class.new(adapter, site, locale) } describe '#all' do subject { repository.all } it { expect(subject.size).to eq 4 } end describe '#by_slug' do subject { repository.by_slug('a_complicated-one') } it { expect(subject).not_to eq nil } end end context 'MongoDB' do it_should_behave_like 'a repository' do let(:site_id) { mongodb_site_id } let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) } end end context 'Filesystem' do it_should_behave_like 'a repository' do let(:site_id) { 1 } let(:adapter) { Locomotive::Steam::FilesystemAdapter.new(default_fixture_site_path) } after(:all) { Locomotive::Steam::Adapters::Filesystem::SimpleCacheStore.new.clear } end end end
Version data entries
20 entries across 20 versions & 1 rubygems