Sha256: da1a4ce7a5b470de0bc3e60a4a189e9b24639a8c794f1f446b47ae24611f578d

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

module RailsBestPractices::Core
  describe Error do
    it "should have highlight with false by default" do
      Error.new.highlight.should == false
    end

    it "should return error with filename, line number and message" do
      Error.new(
        :filename => "app/models/user.rb",
        :line_number => "100",
        :message => "not good",
        :type => "BogusReview").to_s.should == "app/models/user.rb:100 - not good"
    end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_best_practices-1.9.1 spec/rails_best_practices/core/error_spec.rb