Sha256: 89a662d9ebf907b416d73014096c6c85b7b7836a94e578d50ddbaf1d0d88299a

Contents?: true

Size: 933 Bytes

Versions: 18

Compression:

Stored size: 933 Bytes

Contents

# frozen_string_literal: true

require 'fakefs/spec_helpers'
require 'spec_helper'

module Quby::Questionnaires::Repos
  describe MemoryRepo do
    it_behaves_like 'a valid backend for the questionnaires api' do
      let(:repo) { MemoryRepo.new('simple' => File.read('./spec/fixtures/simple.rb')) }
    end

    it_behaves_like 'a questionnaire repository' do
      let(:repo) { MemoryRepo.new }
    end

    describe '#initialize' do
      it 'accepts a hash of keys and definitions to start with' do
        repo = MemoryRepo.new("test1" => "title 'Foo'",
                              "test2" => "title 'Bar'")

        expect(repo.exists?('test1')).to be_truthy
        expect(repo.find('test1').sourcecode).to eq("title 'Foo'")

        expect(repo.exists?('test2')).to be_truthy
        expect(repo.find('test2').sourcecode).to eq("title 'Bar'")

        expect(repo.exists?('test3')).to be_falsey
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
quby-5.0.4 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.3 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.2 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.1 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-4.0.4 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.0.pre4 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.0.pre3 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.0.pre2 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.0.pre1 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-4.0.3 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-4.0.2 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-4.0.1 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-4.0.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-3.2.2 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-3.2.1 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-3.2.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-3.2.0.pre.pre1 spec/quby/questionnaires/repos/memory_repo_spec.rb