Sha256: 633428f9c5db47d0f129c30556567fc5f344bdd4fefe8a91bea53555ac4532d5

Contents?: true

Size: 411 Bytes

Versions: 18

Compression:

Stored size: 411 Bytes

Contents

module ActiveModelHelpers
  def custom_validation(&block)
    define_model(:example, :attr => :integer) do
      validate :custom_validation

      define_method(:custom_validation, &block)
    end.new
  end

  def validating_format(options)
    define_model :example, :attr => :string do
      validates_format_of :attr, options
    end.new
  end
end

RSpec.configure do |c|
  c.include ActiveModelHelpers
end

Version data entries

18 entries across 17 versions & 2 rubygems

Version Path
shoulda-matchers-2.5.0 spec/support/activemodel_helpers.rb
shoulda-matchers-2.4.0 spec/support/activemodel_helpers.rb
shoulda-matchers-2.4.0.rc1 spec/support/activemodel_helpers.rb
shoulda-matchers-2.3.0 spec/support/activemodel_helpers.rb
challah-1.0.0 vendor/bundle/gems/shoulda-matchers-2.2.0/spec/support/activemodel_helpers.rb
shoulda-matchers-2.2.0 spec/support/activemodel_helpers.rb
challah-1.0.0.beta3 vendor/bundle/gems/shoulda-matchers-2.1.0/spec/support/activemodel_helpers.rb
challah-1.0.0.beta3 vendor/bundle/gems/shoulda-matchers-1.5.6/spec/support/activemodel_helpers.rb
shoulda-matchers-2.1.0 spec/support/activemodel_helpers.rb
challah-1.0.0.beta2 vendor/bundle/gems/shoulda-matchers-1.5.6/spec/support/activemodel_helpers.rb
challah-1.0.0.beta vendor/bundle/gems/shoulda-matchers-1.5.6/spec/support/activemodel_helpers.rb
shoulda-matchers-2.0.0 spec/support/activemodel_helpers.rb
shoulda-matchers-1.5.6 spec/support/activemodel_helpers.rb
shoulda-matchers-1.5.5 spec/support/activemodel_helpers.rb
shoulda-matchers-1.5.4 spec/support/activemodel_helpers.rb
shoulda-matchers-1.5.2 spec/support/activemodel_helpers.rb
shoulda-matchers-1.5.1 spec/support/activemodel_helpers.rb
shoulda-matchers-1.5.0 spec/support/activemodel_helpers.rb