Sha256: d855696349f1c5c47e87a5c63de23abe9e2eba201c53643fb8d29f196d80463c

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

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

describe Helpers do
  BINDATA = File.read(File.join(File.dirname(__FILE__), "..", "fixtures", "complex.tgz"))

  include Helpers

  it "should detect text as not binary" do
    "I'm not a cylon!".should_not be_binary
    "/*** Comment nice for v1.4.5 ***/".should_not be_binary
  end

  it "should detect robot talk as binary" do
    BINDATA.should be_binary
    "\u001F\x8B\b\u0000\xF5\u0000".should be_binary
  end

  it "should find from a long version" do
    find_version("frips 1.5.7.786").should eql(["1.5.7.786", 1, 5, 7, 786])
  end

  it "should find version from text" do
    find_version("Foo v 1.5.6").should eql(["1.5.6", 1, 5, 6])
  end

  it "should find version from text" do
    find_version("/*!\n * jQuery JavaScript Library v1.6\n * http://jquery.com/\n *\n * Copyright 2011, John Resig\n * Date: Mon May 2 13:50:00 2011 -0400").
      should eql(["1.6", 1, 6])
  end

  it "should find version from binary" do
    find_version(BINDATA).should eql("c29b335e572251b1b79b88bf8c2847ec")
  end

  it "should rescue fine if there isn`t version" do
    find_version("/* --------------------------------------------------------------   reset.css   * Resets default browser CSS.").
      should eql("d356b6a91b0d16e456c7b4f79302d051")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
assetify-2.0.0 spec/assetify/helpers_spec.rb
assetify-1.0.0 spec/assetify/helpers_spec.rb