Sha256: a56c2d2cb71e8893d991576fbc689c5ecc540eb42d220ce59cedd9c477cc5b84

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require_relative '../spec_helper'
require 'tailor/formatter'

describe Tailor::Formatter do
  describe "#problems_at_level" do
    let(:problems) do
      msg = "File contains invalid Ruby; "
      msg << "run `ruby -c [your_file.rb]` for more details."

      {
        "some_file.rb" => [
          {
            :type => "allow_invalid_ruby",
            :line => 0,
            :column => 0,
            :message => msg,
            :level => :warn
          }
        ]
      }
    end

    context "problems are empty" do
      it "returns an empty Array" do
        subject.problems_at_level({}, :error).should == []
      end
    end

    context "the level asked for exists in the problems" do
      it "returns the problem" do
        msg = "File contains invalid Ruby; "
        msg << "run `ruby -c [your_file.rb]` for more details."

        subject.problems_at_level(problems, :warn).should == [
          {
            :type => "allow_invalid_ruby",
            :line => 0,
            :column => 0,
            :message => msg,
            :level => :warn
          }
        ]
      end
    end

    context "the level asked for does not exist in the problems" do
      it "returns an empty Array" do
        subject.problems_at_level(problems, :error).should == []
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tailor-1.0.1 spec/tailor/formatter_spec.rb
tailor-1.0.0 spec/tailor/formatter_spec.rb