Sha256: da448645105ac36161bf5814c4a4c9bc4d7820c4f43a20ba81543842e8c48da6

Contents?: true

Size: 477 Bytes

Versions: 6

Compression:

Stored size: 477 Bytes

Contents

module ThoughtBot # :nodoc:
  module Shoulda # :nodoc:
    module Private # :nodoc:
      def get_options!(args, *wanted)
        ret  = []
        opts = (args.last.is_a?(Hash) ? args.pop : {})
        wanted.each {|w| ret << opts.delete(w)}
        raise ArgumentError, "Unsuported options given: #{opts.keys.join(', ')}" unless opts.keys.empty?
        return *ret
      end

      def model_class
        self.name.gsub(/Test$/, '').constantize
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
giraffesoft-attribute_fu-0.2 test/vendor/plugins/shoulda/lib/shoulda/private_helpers.rb
pager-resource_controller-1.0.20080513 test/vendor/plugins/shoulda/lib/shoulda/private_helpers.rb
spree-0.4.1 vendor/plugins/attribute_fu/test/vendor/plugins/shoulda/lib/shoulda/private_helpers.rb
spree-0.4.0 vendor/plugins/attribute_fu/test/vendor/plugins/shoulda/lib/shoulda/private_helpers.rb
spree-0.5.0 vendor/plugins/attribute_fu/test/vendor/plugins/shoulda/lib/shoulda/private_helpers.rb
spree-0.5.1 vendor/plugins/attribute_fu/test/vendor/plugins/shoulda/lib/shoulda/private_helpers.rb