Sha256: 00093395b156067dbe61791538fa94572d9fafa6ade7adbe7e3a24a9cb1c3266

Contents?: true

Size: 845 Bytes

Versions: 4

Compression:

Stored size: 845 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'
require 'pathname'

include RepoFixture

describe RepoFixture do
  let(:fixture_class) { RepoFixture }

  describe '#create' do
    it 'yields a fixture object' do
      fixture_class.create do |fixture|
        expect(fixture).to be_a(Fixture)
      end
    end
  end

  describe '#load' do
    it 'calls load on the appropriate strategy class' do
      file = './test.zip'
      mock(ZipStrategy).load(file)
      fixture_class.load(file)
    end
  end

  describe '#strategy_class_for' do
    it 'returns the strategy class for the strategy name' do
      expect(fixture_class.strategy_class_for(:zip)).to eq(ZipStrategy)
    end

    it "raises an error if the strategy doesn't exist" do
      expect(lambda { fixture_class.strategy_class_for(:foo) }).to raise_error(ArgumentError)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
repo-fixture-1.1.0 spec/repo-fixture_spec.rb
repo-fixture-1.0.2 spec/repo-fixture_spec.rb
repo-fixture-1.0.1 spec/repo-fixture_spec.rb
repo-fixture-1.0.0 spec/repo-fixture_spec.rb