Sha256: 2d9b25718c9eb78e72704e5a1bd81aa18dc0c521269971cbad1b3d0da45b6385

Contents?: true

Size: 1.81 KB

Versions: 10

Compression:

Stored size: 1.81 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('`' => 'Error')
    subject.result.should == { type: :cane, check_output: 'Error', status: 'N/A' }
  end
  it "gives OK with no Errors" do
    subject.stub('`' => '')
    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('`' => 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('`' => 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('`' => 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('`' => shell_output)
    subject.result.should == { type: :cane,
                               check_output: shell_output,
                               status: "\e[33m9\e[0m Style Violations" }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rake_check-0.1.8 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.7 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.6 spec_no_rails/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.5 spec_no_rails/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.4 spec_no_rails/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.3 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.2 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.1 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.1.0 spec/lib/rake_check/cane_checker_spec.rb
rake_check-0.0.1 spec/lib/rake_check/cane_checker_spec.rb