Sha256: 5eb94ff2cfd8d57a55e31fe73fa20d1ea44c148faf6f577ab112810e3c0c6dff

Contents?: true

Size: 928 Bytes

Versions: 11

Compression:

Stored size: 928 Bytes

Contents

require 'spec_helper'

module RailsBestPractices::Core
  describe Error do
    it "should return error with filename, line number and message" do
      expect(Error.new(
        filename: "app/models/user.rb",
        line_number: "100",
        message: "not good",
        type: "BogusReview").to_s).to eq("app/models/user.rb:100 - not good")
    end

    it "should return short filename" do
      Runner.base_path = "../rails-bestpractices.com"
      expect(Error.new(
        filename: "../rails-bestpractices.com/app/models/user.rb",
        line_number: "100",
        message: "not good",
        type: "BogusReview").short_filename).to eq("app/models/user.rb")
    end

    it "should return first line number" do
      expect(Error.new(
        filename: "app/models/user.rb",
        line_number: "50,70,100",
        message: "not good",
        type: "BogusReview").first_line_number).to eq("50")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails_best_practices-1.19.0 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.18.1 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.18.0 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.17.0 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.16.0 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.15.7 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.15.6 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.15.4 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.15.3 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.15.2 spec/rails_best_practices/core/error_spec.rb
rails_best_practices-1.15.1 spec/rails_best_practices/core/error_spec.rb