Sha256: 3d085601f5082e622dfe6fa754b8253fce10ad9f6a8bc68290653087099433cf

Contents?: true

Size: 870 Bytes

Versions: 3

Compression:

Stored size: 870 Bytes

Contents

require "test_helper"
require "rubycritic/location"

describe Rubycritic::Location do
  describe "attribute readers" do
    before do
      @path = "./foo"
      @line = 42
      @location = Rubycritic::Location.new(@path, @line)
    end

    it "has a pathname" do
      @location.pathname.must_equal Pathname.new(@path)
    end

    it "has a line number" do
      @location.line.must_equal @line
    end
  end

  it "is comparable" do
    location1 = Rubycritic::Location.new("./foo", 42)
    location2 = Rubycritic::Location.new("./foo", 42)
    location1.must_equal location2
  end

  it "is sortable" do
    location1 = Rubycritic::Location.new("./foo", 42)
    location2 = Rubycritic::Location.new("./bar", 23)
    location3 = Rubycritic::Location.new("./bar", 16)
    [location1, location2, location3].sort.must_equal [location3, location2, location1]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubycritic-0.0.7 test/lib/rubycritic/location_test.rb
rubycritic-0.0.6 test/lib/rubycritic/location_test.rb
rubycritic-0.0.5 test/lib/rubycritic/location_test.rb