Sha256: f8cd32152159b3807834feab6f82ef6030c213d6c84aaceba17b8e3ffaed0294

Contents?: true

Size: 996 Bytes

Versions: 5

Compression:

Stored size: 996 Bytes

Contents

require "spec_helper"
require "gettext_i18n_rails/haml_parser"

describe GettextI18nRails::HamlParser do
  let(:parser){ GettextI18nRails::HamlParser }

  describe "#target?" do
    it "targets .haml" do
      parser.target?('foo/bar/xxx.haml').should == true
    end

    it "does not target anything else" do
      parser.target?('foo/bar/xxx.erb').should == false
    end
  end

  describe "#parse" do
    it "finds messages in haml" do
      with_file '= _("xxxx")' do |path|
        parser.parse(path, []).should == [
          ["xxxx", "#{path}:1"]
        ]
      end
    end

    it "ignores 1.9 errors and shows the paths of offending files" do
      with_file '= _("xxxx", x: 1)' do |path|
        $stderr.should_receive(:puts).with{|x| x =~ /file ignored.*#{path}/ }
        parser.parse(path, [1]).should == [1]
      end
    end

    it "does not find messages in text" do
      with_file '_("xxxx")' do |path|
        parser.parse(path, []).should == []
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gettext_i18n_rails-0.8.0 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.7.2 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.7.1 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.7.0 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.6.6 spec/gettext_i18n_rails/haml_parser_spec.rb