Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for haml_parser ... its not that hard ...
- Loading branch information
Showing
5 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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 "does not find messages in text" do | ||
with_file '_("xxxx")' do |path| | ||
parser.parse(path, []).should == [] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters