Sha256: 8705de459b668f38a31795cad901ebd46f4dafc298d483bcbd4b6425d2e36fe5

Contents?: true

Size: 1.6 KB

Versions: 8

Compression:

Stored size: 1.6 KB

Contents

describe 'BubbleWrap' do


  describe "debug flag" do

    after do
       BubbleWrap.debug = false
    end

    it "can be set" do
      BubbleWrap.debug = true
      BubbleWrap.debug?.should.equal true
    end

    it "can be unset" do
      BubbleWrap.debug = false
      BubbleWrap.debug?.should.equal false
    end

  end

  describe "RGB color" do

    before do
      @red = 23
      @green = 45
      @blue = 12
    end

    it "creates color with rgb devided by 255 with alpha=1" do
      color = UIColor.colorWithRed((@red/255.0), green:(@green/255.0), blue:(@blue/255.0), alpha:1)
      BubbleWrap::rgb_color(@red, @green, @blue).should.equal color
    end

    it "rgba_color uses the real alpha" do
      alpha = 0.4
      color = UIColor.colorWithRed((@red/255.0), green:(@green/255.0), blue:(@blue/255.0), alpha:alpha)
      BubbleWrap::rgba_color(@red, @green, @blue, alpha).should.equal color
    end

  end

  describe "Localized string" do
    
    it "loads the string from NSBundle" do
      key = 'fake_key'
      value = 'fake_value'

      bundle = NSBundle.mainBundle
      def bundle.arguments; @arguments; end
      def bundle.localizedStringForKey(key, value:value, table:table); @arguments = [key, value, table]; end
      
      BubbleWrap::localized_string(key, value)
      bundle.arguments.should.equal [key, value, nil]
    end

  end
  
  describe "uuid" do

    it "creates always the new UUID" do
      previous = BW.create_uuid  
      10.times do
        uuid = BW.create_uuid
        uuid.should.not.equal previous
        uuid.size.should.equal 36
        previous = uuid
      end
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bubble-wrap-1.2.0 spec/motion/core_spec.rb
bubble-wrap-1.2.0.pre spec/motion/core_spec.rb
bubble-wrap-1.1.5 spec/motion/core_spec.rb
bubble-wrap-1.1.4 spec/motion/core_spec.rb
bubble-wrap-1.1.3 spec/motion/core_spec.rb
bubble-wrap-1.1.2 spec/motion/core_spec.rb
bubble-wrap-1.1.1 spec/motion/core_spec.rb
bubble-wrap-1.1.0 spec/motion/core_spec.rb