This file contains hidden or 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
RSpec::Matchers.define :eq_in_one_line do |target| | |
match do |source| | |
source.gsub(/\n/, '').should eq target.gsub(/\n/, '') | |
end | |
end |
This file contains hidden or 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
module Enumerable | |
def each_with_previous | |
self.inject(nil) { |pre, cur| yield pre, cur; cur } | |
self | |
end | |
end |
This file contains hidden or 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
namespace :i18n do | |
desc "Copy translations from simple backend (YAML) to Active Record" | |
task :copy2ar => :environment do | |
unless I18n.backend.instance_of?(I18n::Backend::Simple) | |
I18n.backend = I18n::Backend::Simple.new | |
I18n.backend.load_translations | |
end | |
Translation.delete_all | |
I18n.available_locales.each do |loc| |
This file contains hidden or 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
def assets? | |
begin | |
Rails.application.config.assets.enabled || false | |
rescue NoMethodError | |
false | |
end | |
end |
NewerOlder