Sha256: 7f82c2b0aab1d41b860e5b19709ad6cb2613bc65e9cf2244de60a695c94c4444

Contents?: true

Size: 965 Bytes

Versions: 21

Compression:

Stored size: 965 Bytes

Contents

require "test_helper"
require "rubycritic/core/location"

describe Rubycritic::Location do
  describe "attribute readers" do
    before do
      @path = "./foo.rb"
      @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.to_i
    end

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

21 entries across 21 versions & 1 rubygems

Version Path
rubycritic-2.6.0 test/lib/rubycritic/core/location_test.rb
rubycritic-2.5.0 test/lib/rubycritic/core/location_test.rb
rubycritic-2.4.1 test/lib/rubycritic/core/location_test.rb
rubycritic-2.4.0 test/lib/rubycritic/core/location_test.rb
rubycritic-2.3.0 test/lib/rubycritic/core/location_test.rb
rubycritic-2.2.0 test/lib/rubycritic/core/location_test.rb
rubycritic-2.1.0 test/lib/rubycritic/core/location_test.rb
rubycritic-2.0.0 test/lib/rubycritic/core/location_test.rb
rubycritic-1.4.0 test/lib/rubycritic/core/location_test.rb
rubycritic-1.3.0 test/lib/rubycritic/core/location_test.rb
rubycritic-1.2.1 test/lib/rubycritic/core/location_test.rb
rubycritic-1.2.0 test/lib/rubycritic/core/location_test.rb
rubycritic-1.1.1 test/lib/rubycritic/core/location_test.rb
rubycritic-1.1.0 test/lib/rubycritic/core/location_test.rb
rubycritic-1.0.2 test/lib/rubycritic/core/location_test.rb
rubycritic-1.0.1 test/lib/rubycritic/core/location_test.rb
rubycritic-1.0.0 test/lib/rubycritic/core/location_test.rb
rubycritic-0.0.16 test/lib/rubycritic/core/location_test.rb
rubycritic-0.0.15 test/lib/rubycritic/core/location_test.rb
rubycritic-0.0.14 test/lib/rubycritic/core/location_test.rb