Sha256: f7acc1138a43b78b621d16d988ba6007fc3095f3781b48e50d539b8bd0c081af

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

describe Animoto::Styles do
  describe "deprecated constants" do
    it "should warn you when using a deprecated constant name" do
      Animoto::Styles.expects(:warn)
      Animoto::Styles::ORIGINAL
    end

    it "should inform you of the new constant name" do
      const = Animoto::Styles::DEPRECATED_NAMES[:ORIGINAL].to_s
      Animoto::Styles.expects(:warn).with(regexp_matches(Regexp.compile(const)))
      Animoto::Styles::ORIGINAL
    end

    it "should return the correct value of the new constant name" do
      Animoto::Styles.stubs(:warn)
      Animoto::Styles::ORIGINAL.should == Animoto::Styles::ANIMOTO_ORIGINAL
    end

    it "should define the deprecated constant to suppress multiple warnings" do
      Animoto::Styles.expects(:warn).once
      Animoto::Styles.const_defined?(:ORIGINAL).should_not be_true
      Animoto::Styles::ORIGINAL
      Animoto::Styles.const_defined?(:ORIGINAL).should be_true
      Animoto::Styles::ORIGINAL
    end

    after do
      Animoto::Styles.__send__(:remove_const, :ORIGINAL) if Animoto::Styles.const_defined?(:ORIGINAL)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
animoto-1.5.6 ./spec/animoto/styles_spec.rb
animoto-1.5.5 ./spec/animoto/styles_spec.rb
animoto-1.5.4 ./spec/animoto/styles_spec.rb
animoto-1.5.3 ./spec/animoto/styles_spec.rb
animoto-1.5.2 ./spec/animoto/styles_spec.rb
animoto-1.5.1 ./spec/animoto/styles_spec.rb