Sha256: 531d9463a5e175f85c0722ebc311595fd051328c84338de3dafc64236029fbb9

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

require 'spec_helper'
require 'plugins/pre_commit/checks/checkstyle'

describe PreCommit::Checks::Checkstyle do
  let(:config) {double(PreCommit::Configuration, get: '')}
  let(:check) {PreCommit::Checks::Checkstyle.new(nil, config, [])}

  it "succeds if nothing changed" do
    expect(check.call([])).to be_nil
  end

  it "succeeds for good code" do
    files = [fixture_file('good.java')]
    expect(check.call(files)).to be_nil
  end

  it "fails for bad formatted code" do
    file = fixture_file("bad.java")
    expect(check.call([file])).to eq <<-ERROR
Starting audit...
#{file}:1: Missing a Javadoc comment.
#{file}:1:1: Utility classes should not have a public or default constructor.
#{file}:2:3: Missing a Javadoc comment.
#{file}:2:27: Parameter args should be final.
Audit done.
ERROR
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pre-commit-checkstyle-0.0.1 spec/plugins/pre_commit/checks/checkstyle_spec.rb