Sha256: c7c590863df972724ea555e879012e2762fcc7111325633ad40f3056dd8d5837

Contents?: true

Size: 996 Bytes

Versions: 1

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 "should parse the 1.9 if ruby_version is 1.9" do
      if RUBY_VERSION =~ /^1\.9/
        with_file '= _("xxxx", x: 1)' do |path|
          parser.parse(path, []).should == [
            ["xxxx", "#{path}:1"]
          ]
        end
      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

1 entries across 1 versions & 1 rubygems

Version Path
gettext_i18n_rails-0.9.0 spec/gettext_i18n_rails/haml_parser_spec.rb