Sha256: 443cb977558367a3ed6d878180fcd140b55404247525e2f9d277f80ac2086804

Contents?: true

Size: 897 Bytes

Versions: 5

Compression:

Stored size: 897 Bytes

Contents

require 'spec_helper'

describe Checker::Modules::Yaml do
  it 'should only check .yaml and .yml files' do
    files = ['a.rb', 'b.js.erb', 'c.r', 'd.yml', 'e.yaml']
    mod = Checker::Modules::Yaml.new(files)
    mod.stub(:check_one_file).and_return(true)
    mod.should_receive(:check_one_file).with('d.yml')
    mod.should_receive(:check_one_file).with('e.yaml')
    mod.should_not_receive(:check_one_file).with('a.rb')
    mod.should_not_receive(:check_one_file).with('b.js.erb')
    mod.should_not_receive(:check_one_file).with('c.r')
    mod.check 
  end

  it "should properly fetch yaml files" do
    files = [fixture("yaml", "good.yaml")]
    mod = Checker::Modules::Yaml.new(files)
    mod.check.should be_true
  end

  it "should not pass the syntax check" do
    files = [fixture("yaml", "bad.yaml")]
    mod = Checker::Modules::Yaml.new(files)
    mod.check.should be_false
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
checker-0.6.4 spec/checker/modules/yaml_spec.rb
checker-0.6.3 spec/checker/modules/yaml_spec.rb
checker-0.6.2 spec/checker/modules/yaml_spec.rb
checker-0.6.1 spec/checker/modules/yaml_spec.rb
checker-0.0.6 spec/checker/modules/yaml_spec.rb