Sha256: 7c81b8053a2e7ef775add9cd1205f8da55eb22e15576e9e8ea702be864325de6

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# -*- coding: utf-8 -*-
require "sixarm_ruby_blob_test"

describe Blob do

  let(:dir){ "abc" }
  let(:base){ "def" }
  let(:blob){ Blob.new(dir: dir, base: base) }

  # We choose to use Unix-friendly file names: lowercase a-z and underscores,
  # always with "/" as a directory separator, typically with a dot extension,
  # never with non-ASCII characters.
  #
  let(:base_match){ /^[0-1a-z\_\.]+$/ }
  let(:dir_match){ /^[0-1a-z\_\/]+$/ }
  let(:path_match){ /^[0-1a-z\_\/\.]+$/ }

  describe "#file_dir" do

    it "is the dir" do
      blob.file_dir.must_equal dir
    end

    it "uses a good unix name" do
      blob.file_dir.must_match dir_match
    end

  end

  describe "#file_base" do

    it "is the base" do
      blob.file_base.must_equal base
    end

    it "uses a good unix name" do
      blob.file_base.must_match base_match
    end

  end

  describe "#file_path" do

    it "combines the dir and base" do
      blob.file_path.must_equal "#{dir}/#{base}"
    end

    it "uses a good unix name" do
      blob.file_path.must_match path_match
    end

  end

  describe "#file_exist?" do

    it "returns true iff the file exists" do
      blob.file_exist?  #TODO
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sixarm_ruby_blob-2.0.0 test/sixarm_ruby_blob_test/file_test.rb
sixarm_ruby_blob-1.0.3 test/sixarm_ruby_blob_test/file_test.rb