Sha256: 9877da3d1bc8511dbccd570b090c2c847e4f5ec1f1e17698bda11fb64d168f2a

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

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'),
                                  'simple_with_outcome' => File.read('./spec/fixtures/simple_with_outcome.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

15 entries across 15 versions & 1 rubygems

Version Path
quby-5.6.5 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.6.3 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.6.2 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.6.1 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.6.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.5.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.4.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.3.1 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.3.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.2.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.1.3 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.1.2 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.1.1 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.1.0 spec/quby/questionnaires/repos/memory_repo_spec.rb
quby-5.0.5 spec/quby/questionnaires/repos/memory_repo_spec.rb