Sha256: d18f8753e20ef1debde92271d26e5b9d5a775446f7e3407cc35859bd74bcfe3b

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe Codeqa::Checkers::CheckErb do
  it_behaves_like 'a checker'

  it 'should check erb files' do
    source = source_with('', 'file.html.erb')
    expect(described_class.check?(source)).to be_truthy
    source = source_with('', 'test.rhtml')
    expect(described_class.check?(source)).to be_truthy
    source = source_with('', 'test.text.html')
    expect(described_class.check?(source)).to be_truthy
    source = source_with('', 'zipped.zip')
    expect(described_class.check?(source)).to be_falsey
  end

  it 'should detect syntax errors in the erb' do
    source = source_with('blub<%= def syntax %> ok')
    checker = check_with(described_class, source)
    expect(checker.errors?).to be true
    str = checker.errors.details[0][1]

    expect(str).to match(Regexp.new(Regexp.escape('(erb):1: syntax error, unexpected end-of-input, expect')))
  end
  it 'should be successfull for valid erb' do
    source = source_with('blub<%= var %> ok')
    checker = check_with(described_class, source)
    expect(checker.success?).to be true
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
codeqa-0.5.0 spec/lib/codeqa/checkers/check_erb_spec.rb
codeqa-0.4.2 spec/lib/codeqa/checkers/check_erb_spec.rb
codeqa-0.4.1 spec/lib/codeqa/checkers/check_erb_spec.rb
codeqa-0.4.0 spec/lib/codeqa/checkers/check_erb_spec.rb
codeqa-0.4.0.pre2 spec/lib/codeqa/checkers/check_erb_spec.rb
codeqa-0.4.0.pre spec/lib/codeqa/checkers/check_erb_spec.rb
codeqa-0.3.1 spec/lib/codeqa/checkers/check_erb_spec.rb
codeqa-0.3.0 spec/lib/codeqa/checkers/check_erb_spec.rb