Sha256: c71c4f66c5ff30ea328c5176a4b97a06f986cffa35afdecd92f6c5c8a1d401fe

Contents?: true

Size: 1.86 KB

Versions: 11

Compression:

Stored size: 1.86 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../../lib/rake_check/cane_checker')

describe CaneChecker do
  it "gives N/A on Error" do
    subject.stub(:`).and_return('Error')
    subject.result.should == { type: :cane, check_output: 'Error', status: 'N/A' }
  end
  it "gives OK with no Errors" do
    subject.stub(:`).and_return('')
    subject.result.should == { type: :cane,
                               check_output: '',
                               status: "\e[32mOK\e[0m" }
  end
  it "adds Class and Line violations" do
    shell_output = "Lines violated style requirements (10):\nClasses are not documented (1):"
    subject.stub(:`).and_return(shell_output)
    subject.result.should == { type: :cane,
                               check_output: shell_output,
                               status: "\e[31m11\e[0m Style Violations" }
  end
  it "dont count other infos" do
    shell_output = "Lines violated style requirements (1):
    app/models/foo.rb:14  Line is >100 characters (115)"
    subject.stub(:`).and_return(shell_output)
    subject.result.should == { type: :cane,
                               check_output: shell_output,
                               status: "\e[33m1\e[0m Style Violations" }
  end
  it "is yellow under 10 Violations" do
    shell_output = "Lines violated style requirements (10):"
    subject.stub(:`).and_return(shell_output)
    subject.result.should == { type: :cane,
                               check_output: shell_output,
                               status: "\e[31m10\e[0m Style Violations" }
  end
  it "is red under 10 Violations" do
    shell_output = "Lines violated style requirements (9):"
    subject.stub(:`).and_return(shell_output)
    subject.result.should == { type: :cane,
                               check_output: shell_output,
                               status: "\e[33m9\e[0m Style Violations" }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rake_check-0.3.5 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.3.4 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.3.3 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.3.2 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.3.1 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.3.0 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.2.2 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.2.1 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.2 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.11 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.10 spec/lib/rake_check/cane_checker_spec.rb