create_valid 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
data/create_valid.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{create_valid}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jason Frame"]
data/lib/create_valid.rb CHANGED
@@ -122,6 +122,23 @@ module CreateValid
122
122
  end
123
123
  end
124
124
 
125
+ module TestIntegration
126
+ def self.included(base)
127
+ base.send(:include, InstanceMethods)
128
+ base.alias_method_chain :method_missing, :create_valid
129
+ end
130
+
131
+ module InstanceMethods
132
+ def method_missing_with_create_valid(method, *args)
133
+ if method.to_s =~ ::CreateValid::MAGIC_METHOD
134
+ ::CreateValid::Factory.new(self).send(method, *args)
135
+ else
136
+ method_missing_without_create_valid(method, *args)
137
+ end
138
+ end
139
+ end
140
+ end
141
+
125
142
  class KludgyEvalContext
126
143
  include GlobalHelpers
127
144
  end
data/rails/init.rb CHANGED
@@ -1,16 +1,6 @@
1
1
  if defined?(RAILS_ENV) && RAILS_ENV == 'test'
2
- class ActiveSupport::TestCase
3
- def method_missing_with_create_valid(method, *args)
4
- if method.to_s =~ ::CreateValid::MAGIC_METHOD
5
- ::CreateValid::Factory.new(self).send(method, *args)
6
- else
7
- method_missing_without_create_valid(method, *args)
8
- end
9
- end
10
- alias_method_chain :method_missing, :create_valid
11
- end
12
-
13
- Kernel.send(:include, ::CreateValid::GlobalHelpers)
2
+ require 'test/unit'
3
+ ::ActiveSupport::TestCase.send(:include, ::CreateValid::TestIntegration)
14
4
 
15
5
  if File.exists?(RAILS_ROOT + '/test/factory.rb')
16
6
  ::CreateValid::KludgyEvalContext.new.instance_eval(File.read(RAILS_ROOT + '/test/factory.rb'))
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jason Frame