Sha256: 42ef3aa1ec50ed7ee99931548c68828f7708be7b3ca0c0865d0233fa7c957383

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

require 'test_helper'

describe Unitwise::Prefix do
  subject { Unitwise::Prefix }
  let(:m) { Unitwise::Prefix.find('m')}
  describe "::data" do
    it "should be an Array" do
      subject.data.must_be_instance_of Array
    end
  end

  describe "::all" do
    it "should be an array of prefixes" do
      subject.all.must_be_instance_of Array
      subject.all.sample.must_be_instance_of Unitwise::Prefix
    end
  end

  describe "#scalar" do
    it "should be a number" do
      m.scalar.must_equal 0.001
    end
  end

  describe "#search" do
    it "should search for a prefix" do
      result = subject.search("mi")
      result.count.must_equal 3
      result.must_include subject.find("milli")
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unitwise-0.3.2 test/unitwise/prefix_test.rb
unitwise-0.3.1 test/unitwise/prefix_test.rb