Sha256: b0549e51db3102ed0df8a85a08b507a9705955385fb5465021a6512f1025429a

Contents?: true

Size: 1.39 KB

Versions: 4

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe Checker::Modules::Ruby do
  it 'should only check .rb files' do
    files = ['a.rb', 'b.js.erb', 'c.r']
    mod = Checker::Modules::Ruby.new(files)
    mod.stub(:check_one_file).and_return(stub(:success? => true, :status => :ok))
    mod.should_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

  # 1.8
  if RUBY_VERSION < "1.9"
    it "should pass the syntax check" do
      files = [fixture("ruby", "1.8/good.rb")]
      mod = Checker::Modules::Ruby.new(files)
      mod.check.should be_true
    end

    it "should not pass the syntax check" do
      files = [fixture("ruby", "1.8/bad.rb")]
      mod = Checker::Modules::Ruby.new(files)
      mod.check.should be_false
    end

    it "should not pass the syntax check" do
      files = [fixture("ruby", "1.8/bad2.rb")]
      mod = Checker::Modules::Ruby.new(files)
      mod.check.should be_false
    end
  end

  if RUBY_VERSION >= "1.9"
    it "should pass the syntax check" do
      files = [fixture("ruby", "1.9/good.rb")]
      mod = Checker::Modules::Ruby.new(files)
      mod.check.should be_true
    end

    it "should not pass the syntax check" do
      files = [fixture("ruby", "1.9/bad.rb")]
      mod = Checker::Modules::Ruby.new(files)
      mod.check.should be_false
    end
  end
  # 1.9
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
checker-0.6.6 spec/checker/modules/ruby_spec.rb
checker-0.6.5 spec/checker/modules/ruby_spec.rb
checker-0.6.5.rc2 spec/checker/modules/ruby_spec.rb
checker-0.6.5.rc1 spec/checker/modules/ruby_spec.rb