Sha256: c37d13b16e36057d7493dcb35a7febfc17ece8bf8b47271c591ec8ce3202e536

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'
require 'magic_reveal/reveal_js_fetcher'

describe MagicReveal::RevealJsFetcher do
  subject { described_class.new version }
  let(:version) { "#{rand 9}.#{rand 9}.#{rand 9}" }

  describe "#new" do
    its(:version) { should be(version) }
  end

  describe ".zip_url" do
    its(:zip_url) { should match(/#{Regexp.escape version}\.zip\Z/) }
  end

  describe ".conductor" do
    it "uses the zip_url" do
      MagicReveal::Conductor.should_receive(:new).with(subject.zip_url)
      subject.conductor
    end

    it "returns the conductor" do
      expect(subject.conductor).to be_kind_of(MagicReveal::Conductor)
    end
  end

  describe ".save_to" do
    let(:conductor) { double(MagicReveal::Conductor).as_null_object }
    let(:reveal_dir) { Pathname.new(Dir.tmpdir) + "save_to_test#{rand 99}" }
    before do
      subject.conductor = conductor
      conductor.stub(:fetch) { |zipfile| @zipfile = zipfile }
      subject.save_to reveal_dir
    end

    it "uses conductor to fetch the zipfile" do
      expect(conductor).to have_received(:fetch).with(anything)
    end

    it "uses conductor to fetch the zipfile" do
      expect(conductor).to have_received(:unpack).
        with(@zipfile, reveal_dir)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
magic_reveal-2.6.1.2 spec/magic_reveal/reveal_js_fetcher_spec.rb
magic_reveal-2.6.1.1 spec/magic_reveal/reveal_js_fetcher_spec.rb
magic_reveal-2.4.0.5 spec/magic_reveal/reveal_js_fetcher_spec.rb
magic_reveal-2.4.0.4 spec/magic_reveal/reveal_js_fetcher_spec.rb
magic_reveal-2.4.0.3 spec/magic_reveal/reveal_js_fetcher_spec.rb
magic_reveal-2.4.0.2 spec/magic_reveal/reveal_js_fetcher_spec.rb
magic_reveal-2.4.0.1 spec/magic_reveal/reveal_js_fetcher_spec.rb