Sha256: 3d213547791c6fd40de01aefb40829c8e91bc55a887fb585cdb992f17940f512

Contents?: true

Size: 948 Bytes

Versions: 18

Compression:

Stored size: 948 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" do
      with_file '= _("xxxx", x: 1)' do |path|
        $stderr.should_receive(:puts).with{|x| x =~ /file ignored/ }
        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

18 entries across 18 versions & 2 rubygems

Version Path
gettext_i18n_rails-0.6.5 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.6.4 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.6.3 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.6.2 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.6.1 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.5.4 spec/gettext_i18n_rails/haml_parser_spec.rb
nulogy-gettext_i18n_rails-0.5.3.2 spec/gettext_i18n_rails/haml_parser_spec.rb
nulogy-gettext_i18n_rails-0.5.3.1 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.5.3 spec/gettext_i18n_rails/haml_parser_spec.rb
nulogy-gettext_i18n_rails-0.5.0.3 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.5.2 spec/gettext_i18n_rails/haml_parser_spec.rb
nulogy-gettext_i18n_rails-0.5.0.2 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.5.1 spec/gettext_i18n_rails/haml_parser_spec.rb
nulogy-gettext_i18n_rails-0.5.0.1 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.5.0 spec/gettext_i18n_rails/haml_parser_spec.rb
nulogy-gettext_i18n_rails-0.4.6.2 spec/gettext_i18n_rails/haml_parser_spec.rb
nulogy-gettext_i18n_rails-0.4.6.1 spec/gettext_i18n_rails/haml_parser_spec.rb
gettext_i18n_rails-0.4.6 spec/gettext_i18n_rails/haml_parser_spec.rb