Sha256: 7ab72723ffd4a589f5b6d094a7f3bd92e8e0c735b319da4be773eb7724f3a9ac

Contents?: true

Size: 1.15 KB

Versions: 20

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

require_relative '../../../lib/locomotive/steam/adapters/filesystem.rb'
require_relative '../../../lib/locomotive/steam/adapters/mongodb.rb'

describe Locomotive::Steam::SiteRepository do

  let(:repository) { described_class.new(adapter) }

  shared_examples_for 'a repository' do

    describe '#query' do
      subject { repository.query { where(handle: 'sample') }.first }
      it { expect(subject.name).to eq 'Sample site' }
    end

    describe '#by_domain' do
      subject { repository.by_domain('sample.example.com') }
      it { expect(subject).not_to eq nil }
    end

  end

  context 'MongoDB' do

    let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }

    it_behaves_like 'a repository'

    describe '#all' do
      subject { repository.all }
      it { expect(subject.size).to eq 2 }
    end

  end

  context 'Filesystem' do

    let(:adapter) { Locomotive::Steam::FilesystemAdapter.new(default_fixture_site_path) }

    it_behaves_like 'a repository'

    describe '#all' do
      subject { repository.all }
      it { expect(subject.size).to eq 1 }
    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.8.0.alpha1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.7.1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.7.0 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.6.1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.6.0 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.6.0.rc1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.6.0.beta1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.3 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.2 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.0 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.0.rc1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.0.rc0 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.0.beta3 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.0.beta2 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.5.0.beta1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.4.1 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.4.0 spec/integration/repositories/site_repository_spec.rb
locomotivecms_steam-1.4.0.rc2 spec/integration/repositories/site_repository_spec.rb