Sha256: 458c59f10dfe0484f06f67fc034218db7d1f29318b79cd72e337b6e13d60bc04

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'
require 'logger'
require 'stringio'

describe Dragonfly do
  it "returns a default app" do
    Dragonfly.app.should == Dragonfly::App.instance
  end

  it "returns a named app" do
    Dragonfly.app(:mine).should == Dragonfly::App.instance(:mine)
  end

  describe "logging" do
    context "logger exists" do
      before do
        Dragonfly.logger = Logger.new(StringIO.new)
      end

      it "debugs" do
        Dragonfly.logger.should_receive(:debug).with(/something/)
        Dragonfly.debug("something")
      end

      it "warns" do
        Dragonfly.logger.should_receive(:warn).with(/something/)
        Dragonfly.warn("something")
      end

      it "shows info" do
        Dragonfly.logger.should_receive(:info).with(/something/)
        Dragonfly.info("something")
      end
    end

    context "logger is nil" do
      before do
        allow_message_expectations_on_nil
        Dragonfly.logger = nil
      end

      it "does not call debug" do
        Dragonfly.logger.should_not_receive(:debug)
        Dragonfly.debug("something")
      end

      it "does not warn" do
        Dragonfly.logger.should_not_receive(:warn)
        Dragonfly.warn("something")
      end

      it "does not show info" do
        Dragonfly.logger.should_not_receive(:info)
        Dragonfly.info("something")
      end
    end
  end

  describe "deprecations" do
    it "raises a message when using Dragonfly[:name]" do
      expect {
        Dragonfly[:images]
      }.to raise_error(/deprecated/)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dragonfly-1.4.1 spec/dragonfly_spec.rb
dragonfly-1.4.0 spec/dragonfly_spec.rb
dragonfly-1.3.0 spec/dragonfly_spec.rb
dragonfly-1.2.1 spec/dragonfly_spec.rb