From 10653c227c62b513f99be11ff2d7ae7e75400f8a Mon Sep 17 00:00:00 2001 From: Christoph Olszowka Date: Tue, 13 Sep 2011 19:35:18 +0200 Subject: [PATCH] Added cucumber feature that verifies utf-8 compatibility in source files (as a reaction to #71) --- features/unicode_compatiblity.feature | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 features/unicode_compatiblity.feature diff --git a/features/unicode_compatiblity.feature b/features/unicode_compatiblity.feature new file mode 100644 index 00000000..e802c7ab --- /dev/null +++ b/features/unicode_compatiblity.feature @@ -0,0 +1,67 @@ +@test_unit @unicode +Feature: + + Files with unicode in their source should be no problem at all for + generating a proper coverage report. + + Background: + Given SimpleCov for Test/Unit is configured with: + """ + require 'simplecov' + SimpleCov.start 'test_frameworks' + """ + + Scenario: Snowman inside method string + Given a file named "lib/faked_project/unicode.rb" with: + """ + # encoding: UTF-8 + class SourceCodeWithUnicode + def self.yell! + puts "☃" + end + end + """ + + When I open the coverage report generated with `bundle exec rake test` + Then I should see the groups: + | name | coverage | files | + | All Files | 86.67% | 5 | + + And I should see the source files: + | name | coverage | + | lib/faked_project.rb | 100.0 % | + | lib/faked_project/some_class.rb | 80.0 % | + | lib/faked_project/framework_specific.rb | 75.0 % | + | lib/faked_project/meta_magic.rb | 100.0 % | + | lib/faked_project/unicode.rb | 66.67 % | + + And the report should be based upon: + | Unit Tests | + + Scenario: Author name in comment + Given a file named "lib/faked_project/unicode.rb" with: + """ + # encoding: UTF-8 + # author: Javiér Hernández + class SomeClassWrittenByAForeigner + def self.yell! + foo + end + end + """ + + When I open the coverage report generated with `bundle exec rake test` + Then I should see the groups: + | name | coverage | files | + | All Files | 86.67% | 5 | + + And I should see the source files: + | name | coverage | + | lib/faked_project.rb | 100.0 % | + | lib/faked_project/some_class.rb | 80.0 % | + | lib/faked_project/framework_specific.rb | 75.0 % | + | lib/faked_project/meta_magic.rb | 100.0 % | + | lib/faked_project/unicode.rb | 66.67 % | + + And the report should be based upon: + | Unit Tests |