Sha256: d26e274ecf7500702b2e865c528af3774666ce53481c78efe91b3b626aa4022d

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'rubygems'
require 'rspec'
require 'imw' ; include IMW

describe "IMW::Uri" do
  before :each do
    @uri = Uri.new("test.csv")
  end

  it "should respond to scheme" do
    @uri.should respond_to(:scheme)
  end

  context "A Uri.scheme" do
    before :each do
      @local = "/path/to/file.csv"
      @s3    = "s3://s3-bucket/path/to/file.csv"
      @hdfs  = "hdfs://namenodehost/path/to/file.csv"
    end

    it "should understand the local file scheme" do
      Uri.new(@local).scheme.should == 'Local'
    end

    it "should understand the s3 file scheme" do
      Uri.new(@s3).scheme.should == 'S3'
    end

    it "should understand the hadoop file system" do
      Uri.new(@hdfs).scheme.should == 'Hdfs'
    end

  end

  it "should respond to format" do
    @uri.should respond_to(:format)
  end

  context "A Uri.format" do
    before :each do
      @csv     = "foo.csv"
      @tsv     = "foo.tsv"
      @json    = "foo.json"
      @yaml    = "foo.yml"
      @invalid = "foor.bar"
    end

    it "should raise an error when given an invalid format" do
      lambda { Uri.new(@invalid) }.should raise_error(IMW::Error::InvalidFormatError)
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imw-0.3.0 spec/uri_spec.rb