test_dummy 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -42,6 +42,11 @@ The name of the test/dummy file should be the same as the main model
42
42
  defined in app/models. For instance, app/models/my_model.rb would have a
43
43
  corresponding test/dummy/my_model.rb that would be loaded as required.
44
44
 
45
+ If you need to override this directory, you can configure the gem using
46
+ the `dummy_directory` option:
47
+
48
+ TestDummy.dummy_directory = 'my_alternate/path'
49
+
45
50
  == Copyright
46
51
 
47
- Copyright (c) 2010 Scott Tadman, The Working Group
52
+ Copyright (c) 2010-2011 Scott Tadman, The Working Group
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.9
data/lib/test_dummy.rb CHANGED
@@ -1,8 +1,19 @@
1
1
  module TestDummy
2
- require 'test_dummy/railtie'
2
+ if (defined?(Rails))
3
+ # Only load the Railtie if Rails is loaded.
4
+ require 'test_dummy/railtie'
5
+ end
3
6
 
4
7
  autoload(:Helper, File.expand_path('test_dummy/helper', File.dirname(__FILE__)))
5
8
  autoload(:TestHelper, File.expand_path('test_dummy/test_helper', File.dirname(__FILE__)))
9
+
10
+ def self.dummy_directory
11
+ @dummy_directory or (defined?(Rails) and Rails.root)
12
+ end
13
+
14
+ def self.dummy_directory=(value)
15
+ @dummy_directory = value
16
+ end
6
17
 
7
18
  def self.included(base)
8
19
  base.send(:extend, ClassMethods)
@@ -219,7 +230,10 @@ module TestDummy
219
230
 
220
231
  @_dummy_module =
221
232
  begin
222
- dummy_path = File.expand_path("test/dummy/#{name.underscore}.rb", Rails.root)
233
+ dummy_path = File.expand_path(
234
+ "test/dummy/#{name.underscore}.rb",
235
+ TestDummy.dummy_directory
236
+ )
223
237
 
224
238
  if (File.exist?(dummy_path))
225
239
  load dummy_path
data/test_dummy.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "test_dummy"
8
- s.version = "0.2.8"
8
+ s.version = "0.2.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tadman"]
12
- s.date = "2011-10-03"
12
+ s.date = "2011-10-19"
13
13
  s.description = "Test Dummy allows you to define how to fake models automatically so that you can use dummy data for testing instead of fixtures. Dummy models are always generated using the current schema and don't need to me migrated like fixtures."
14
14
  s.email = "github@tadman.ca"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_dummy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-03 00:00:00.000000000Z
12
+ date: 2011-10-19 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Test Dummy allows you to define how to fake models automatically so that
15
15
  you can use dummy data for testing instead of fixtures. Dummy models are always