Module: GettextTestLog

Extended by:
GettextTestLog
Included in:
GettextTestLog
Defined in:
lib/gettext_test_log.rb

Constant Summary collapse

SEPERATOR =
"\nNEXT-WORD\n"

Instance Method Summary collapse

Instance Method Details

#activate_test_loggingObject

call this inside your spec_helper.rb to activate test message storage



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gettext_test_log.rb', line 17

def activate_test_logging
  if ENV['LOG_GETTEXT']
    require 'gettext_test_log/fast_gettext_stub'
    Spec::Runner.configure do |config|
      #TODO only call after the 'last' test was executed
      config.after(:all) do
        File.open(ENV['LOG_GETTEXT'],'w') do |f|
          f.puts FastGettext::Translation::TRANSLATIONS_USED * SEPERATOR
        end
      end
    end
  end
end

#write_test_log(storage_file, options = {}) ⇒ Object

write to a given file, which msgids where found in the ‘rake updatepo` recogniseable format _(“msgid”)



7
8
9
10
11
12
13
# File 'lib/gettext_test_log.rb', line 7

def write_test_log(storage_file,options={})
  messages = messages_from_test_run
  if excluded = options[:exclude_msgids_in_po_files]
    messages -= msgids_in_po_files(excluded)
  end
  store_messages(messages,storage_file)
end