Sha256: e7b40511cf91f0ab0b948eddf82be6b3016824dedf23bd0aa42bbed16c604390

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Jsus::Validator::Mooforge do
  describe "#validate" do
    let(:input_dir) { "spec/data/MooforgeValidation/app/javascripts/Orwik/Source/Library" }
    let!(:sources) {
      ["Valid.js", "InvalidNoAuthors.js", "InvalidNoLicense.js"].map {|fn| Jsus::SourceFile.from_file("#{input_dir}/#{fn}") }
    }

    it "should return true for valid files" do
      described_class.validate([sources[0]]).should be_true
      described_class.new([sources[0]]).validation_errors.should == []
    end
    
    it "should return false for files without authors" do
      described_class.validate([sources[1]]).should be_false
      described_class.new([sources[1]]).validation_errors[0].should include(sources[1].filename)
    end
    
    it "should return false for files without license" do
      described_class.validate([sources[2]]).should be_false
      described_class.new([sources[2]]).validation_errors[0].should include(sources[2].filename)
    end    
        
    it "should return false when some of the files fail" do
      described_class.validate(sources).should be_false
      described_class.new(sources).validation_errors.size.should == 2      
    end    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jsus-0.2.5 spec/jsus/validator/mooforge_spec.rb
jsus-0.2.4 spec/jsus/validator/mooforge_spec.rb
jsus-0.2.3 spec/jsus/validator/mooforge_spec.rb
jsus-0.2.2 spec/jsus/validator/mooforge_spec.rb
jsus-0.2.1 spec/jsus/validator/mooforge_spec.rb
jsus-0.2.0 spec/jsus/validator/mooforge_spec.rb