Sha256: 200399b4261411591f2cd2a03a63c8e4285454abd86c82c7d0a5783731898b5d

Contents?: true

Size: 679 Bytes

Versions: 8

Compression:

Stored size: 679 Bytes

Contents

require 'rspec'

require 'active_support/all'
require 'active_model'

require 'grouped_validations'

class TestModel
  include ActiveSupport::Callbacks
  include ActiveModel::Validations

  attr_accessor :persisted, :first_name, :last_name, :sex
  alias_method :persisted?, :persisted
end

class Person < TestModel
end

module SpecHelper
  def reset_class(klass, &block)
    superklass = klass.superclass
    name = klass.name.to_sym
    Object.send(:remove_const, name)
    Object.const_set(name, Class.new(superklass))
    new_klass = Object.const_get(name)
    new_klass.class_eval &block if block_given?
  end
end

RSpec.configure do |config|
  config.include SpecHelper
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
grouped_validations-0.3.3 spec/spec_helper.rb
grouped_validations-0.3.2 spec/spec_helper.rb
grouped_validations-0.3.1 spec/spec_helper.rb
monkey_forms-0.0.20 lib/monkey_forms/vendor/grouped_validations/spec/spec_helper.rb
monkey_forms-0.0.19 lib/monkey_forms/vendor/grouped_validations/spec/spec_helper.rb
monkey_forms-0.0.18 lib/monkey_forms/vendor/grouped_validations/spec/spec_helper.rb
monkey_forms-0.0.17 lib/monkey_forms/vendor/grouped_validations/spec/spec_helper.rb
grouped_validations-0.3.0 spec/spec_helper.rb