Sha256: 4a6b14df63b3c75850f52a2d310335613ce5739d9965f78f312e09388ccd4e0b

Contents?: true

Size: 928 Bytes

Versions: 4

Compression:

Stored size: 928 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 file path" do
      @location.path.must_equal @path
    end

    it "has a file name" do
      @location.file.must_equal "foo"
    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

4 entries across 4 versions & 1 rubygems

Version Path
rubycritic-0.0.4 test/lib/rubycritic/location_test.rb
rubycritic-0.0.3 test/lib/rubycritic/location_test.rb
rubycritic-0.0.2 test/lib/rubycritic/location_test.rb
rubycritic-0.0.1 test/lib/rubycritic/location_test.rb