Sha256: ec74cfb91938bebb58635ef95c91a4b5802cffea6c500dc6fb239faf5c9f0c53
Contents?: true
Size: 822 Bytes
Versions: 4
Compression:
Stored size: 822 Bytes
Contents
require 'rspec' require 'ruby-debug' require 'ar-enums' RSpec.configure do |config| config.before :suite do ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") load(File.dirname(__FILE__) + "/schema.rb") end def define_model_class(name = "TestClass", parent_class_name = "ActiveRecord::Base", &block) ActiveSupport::Dependencies.send :remove_const, name rescue nil eval("class #{name} < #{parent_class_name}; end", TOPLEVEL_BINDING) klass = eval(name, TOPLEVEL_BINDING) klass.class_eval(&block) if block_given? end end RSpec::Matchers.define :be_enum_with do |expected_attrs| match do |enum| enum.should be_a(ActiveRecord::Enum) expected_attrs.each do |atrib, expected_value| enum.send(atrib).should == expected_value end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ar-enums-0.3.9 | spec/spec_helper.rb |
ar-enums-0.3.8 | spec/spec_helper.rb |
ar-enums-0.3.7 | spec/spec_helper.rb |
ar-enums-0.3.6 | spec/spec_helper.rb |