Sha256: 498183a16cde3fa1e13f0334df9fc43478fbfd06762a7aa6aaa3a1c337b4b74c

Contents?: true

Size: 996 Bytes

Versions: 11

Compression:

Stored size: 996 Bytes

Contents

if defined?(Spec)
  module Spec #:nodoc:
    module Example #:nodoc:
      module ExampleGroupMethods #:nodoc:

        # This allows "describe User" to use the I18n human name of User.
        #
        def self.build_description_with_i18n(*args)
          args.inject("") do |description, arg|
            arg = if arg.respond_to?(:human_name)
              arg.human_name(:locale => Remarkable.locale)
            else
              arg.to_s
            end

            description << " " unless (description == "" || arg =~ /^(\s|\.|#)/)
            description << arg
          end
        end

        # This is for rspec <= 1.1.12.
        #
        def self.description_text(*args)
          self.build_description_with_i18n(*args)
        end

        # This is for rspec >= 1.2.0.
        #
        def self.build_description_from(*args)
          text = ExampleGroupMethods.build_description_with_i18n(*args)
          text == "" ? nil : text
        end

      end
    end
  end
end

Version data entries

11 entries across 11 versions & 5 rubygems

Version Path
yeastymobs-remarkable_mongomapper-0.1.1 lib/remarkable_mongomapper/human_names.rb
remarkable_mongo-0.1.4 lib/remarkable/mongo_mapper/human_names.rb
remarkable_mongo-0.1.3 lib/remarkable/mongo_mapper/human_names.rb
remarkable_mongo_ign-0.1.2 lib/remarkable/mongo_mapper/human_names.rb
ippy04-remarkable_mongo-0.1.3 lib/remarkable/mongo_mapper/human_names.rb
remarkable_activerecord-3.1.13 lib/remarkable_activerecord/human_names.rb
remarkable_activerecord-3.1.12 lib/remarkable_activerecord/human_names.rb
remarkable_mongo-0.1.2 lib/remarkable/mongo_mapper/human_names.rb
remarkable_activerecord-3.1.11 lib/remarkable_activerecord/human_names.rb
remarkable_activerecord-3.1.10 lib/remarkable_activerecord/human_names.rb
remarkable_activerecord-3.1.9 lib/remarkable_activerecord/human_names.rb