fluent_fixtures 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/.document +5 -0
- data/.rdoc_options +16 -0
- data/.simplecov +9 -0
- data/ChangeLog +48 -0
- data/GettingStarted.md +26 -0
- data/History.md +9 -0
- data/LICENSE.txt +20 -0
- data/Manifest.txt +19 -0
- data/README.md +77 -0
- data/Rakefile +97 -0
- data/lib/fluent_fixtures/collection.rb +137 -0
- data/lib/fluent_fixtures/dsl.rb +106 -0
- data/lib/fluent_fixtures/factory.rb +201 -0
- data/lib/fluent_fixtures.rb +29 -0
- data/spec/fluent_fixtures/collection_spec.rb +145 -0
- data/spec/fluent_fixtures/dsl_spec.rb +108 -0
- data/spec/fluent_fixtures/factory_spec.rb +234 -0
- data/spec/fluent_fixtures_spec.rb +15 -0
- data/spec/spec_helper.rb +23 -0
- data.tar.gz.sig +0 -0
- metadata +235 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d33bbaa00f8e53051894c6cdfa9696965a1fb73
|
4
|
+
data.tar.gz: 1cf3f1e78b8ae7532782df1b657ae5b0ef365d88
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: da3d7e7e75da53dccd23a834f6eeeec0a531203b51c5385b4dda469eb4a39eb60040df7d0244465a3e24d7f455a53c4c3b76f7288686e035edf38141f40bb9ac
|
7
|
+
data.tar.gz: 4def254094af54a2f4f4c72f1425a7d124717d552e588226c5c6f8ba48e40e4634dc3067287ae2f7b0216a96a3f7a40e45b835f0378f6aa52956a3c65b0575f1
|
checksums.yaml.gz.sig
ADDED
data/.document
ADDED
data/.rdoc_options
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
--- !ruby/object:RDoc::Options
|
2
|
+
encoding: UTF-8
|
3
|
+
static_path: []
|
4
|
+
rdoc_include:
|
5
|
+
- .
|
6
|
+
charset: UTF-8
|
7
|
+
exclude:
|
8
|
+
hyperlink_all: false
|
9
|
+
line_numbers: false
|
10
|
+
main_page: README.md
|
11
|
+
markup: markdown
|
12
|
+
show_hash: false
|
13
|
+
tab_width: 8
|
14
|
+
title: fluent_fixtures Documentation
|
15
|
+
visibility: :protected
|
16
|
+
webcvs:
|
data/.simplecov
ADDED
data/ChangeLog
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
2016-06-01 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* History.md, lib/fluent_fixtures.rb:
|
4
|
+
Bump the patch version, update history.
|
5
|
+
[e500071dd9c0] [tip]
|
6
|
+
|
7
|
+
* Rakefile, fluent_fixtures.gemspec:
|
8
|
+
Remove the release failsafe from the Rakefile
|
9
|
+
[61698db3838e]
|
10
|
+
|
11
|
+
* .hgtags:
|
12
|
+
Added tag v0.0.1 for changeset cd547b1e30a8
|
13
|
+
[e26dbd686588]
|
14
|
+
|
15
|
+
* .hgsigs:
|
16
|
+
Added signature for changeset 588b8ccc042c
|
17
|
+
[cd547b1e30a8] [v0.0.1]
|
18
|
+
|
19
|
+
* History.md:
|
20
|
+
Update history
|
21
|
+
[588b8ccc042c]
|
22
|
+
|
23
|
+
* .hgignore, .hoerc, ChangeLog, Manifest.txt, fluent_fixtures.gemspec,
|
24
|
+
lib/fluent_fixtures/dsl.rb, lib/fluent_fixtures/factory.rb:
|
25
|
+
Clean up the manifest a bit.
|
26
|
+
[41b90ff8e6d0]
|
27
|
+
|
28
|
+
* .editorconfig, .hgignore, ChangeLog, GettingStarted.md, README.md,
|
29
|
+
Rakefile, examples/acme_fixtures.rb, examples/lib/acme.rb,
|
30
|
+
examples/lib/acme/base.rb, examples/lib/acme/fixtures.rb,
|
31
|
+
examples/lib/acme/fixtures/groups.rb,
|
32
|
+
examples/lib/acme/fixtures/users.rb, examples/lib/acme/group.rb,
|
33
|
+
examples/lib/acme/user.rb:
|
34
|
+
Add the start of examples and a "Getting Started" guide
|
35
|
+
[2230db2a4a5a] [github/master]
|
36
|
+
|
37
|
+
* .document, .editorconfig, .gems, .gitignore, .hgignore, .pryrc,
|
38
|
+
.rdoc_options, .ruby-gemset, .ruby-version, .simplecov, Gemfile,
|
39
|
+
History.md, LICENSE.txt, Manifest.txt, README.md, Rakefile,
|
40
|
+
certs/ged.pem, fluent_fixtures.gemspec, lib/fluent_fixtures.rb,
|
41
|
+
lib/fluent_fixtures/collection.rb, lib/fluent_fixtures/dsl.rb,
|
42
|
+
lib/fluent_fixtures/factory.rb,
|
43
|
+
spec/fluent_fixtures/collection_spec.rb,
|
44
|
+
spec/fluent_fixtures/dsl_spec.rb,
|
45
|
+
spec/fluent_fixtures/factory_spec.rb, spec/fluent_fixtures_spec.rb,
|
46
|
+
spec/spec_helper.rb:
|
47
|
+
Initial import
|
48
|
+
[76c036a3676b]
|
data/GettingStarted.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Getting Started With Fluent Fixtures
|
2
|
+
|
3
|
+
Declare a module that will act as a collection of fixtures:
|
4
|
+
|
5
|
+
# lib/acme/fixtures.rb
|
6
|
+
require 'fluent_fixtures'
|
7
|
+
module Acme::Fixtures
|
8
|
+
extend FluentFixtures::Collection
|
9
|
+
fixture_path_prefix 'acme/fixtures'
|
10
|
+
end
|
11
|
+
|
12
|
+
This module will act as the main interface to all of ACME's fixtures.
|
13
|
+
|
14
|
+
First, we'll add a bare-bones `user` fixture for creating instances of a hypothetical `Acme::User` class:
|
15
|
+
|
16
|
+
# lib/acme/fixtures/users.rb
|
17
|
+
require 'acme/fixtures'
|
18
|
+
require 'acme/user
|
19
|
+
module Acme::Fixtures::Users
|
20
|
+
extend Acme::Fixtures
|
21
|
+
fixtured_class Acme::User
|
22
|
+
end
|
23
|
+
|
24
|
+
[...more soon]
|
25
|
+
|
26
|
+
|
data/History.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2016 Michael Granger
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
.document
|
2
|
+
.rdoc_options
|
3
|
+
.simplecov
|
4
|
+
ChangeLog
|
5
|
+
GettingStarted.md
|
6
|
+
History.md
|
7
|
+
LICENSE.txt
|
8
|
+
Manifest.txt
|
9
|
+
README.md
|
10
|
+
Rakefile
|
11
|
+
lib/fluent_fixtures.rb
|
12
|
+
lib/fluent_fixtures/collection.rb
|
13
|
+
lib/fluent_fixtures/dsl.rb
|
14
|
+
lib/fluent_fixtures/factory.rb
|
15
|
+
spec/fluent_fixtures/collection_spec.rb
|
16
|
+
spec/fluent_fixtures/dsl_spec.rb
|
17
|
+
spec/fluent_fixtures/factory_spec.rb
|
18
|
+
spec/fluent_fixtures_spec.rb
|
19
|
+
spec/spec_helper.rb
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# fluent_fixtures
|
2
|
+
|
3
|
+
home
|
4
|
+
: http://deveiate.org/projects/FluentFixtures
|
5
|
+
|
6
|
+
code
|
7
|
+
: http://bitbucket.org/ged/fluent_fixtures
|
8
|
+
|
9
|
+
github
|
10
|
+
: https://github.com/ged/fluent_fixtures
|
11
|
+
|
12
|
+
docs
|
13
|
+
: http://deveiate.org/code/fluent_fixtures
|
14
|
+
|
15
|
+
|
16
|
+
## Description
|
17
|
+
|
18
|
+
A toolkit for building a collection of composable testing fixtures with a fluent interface.
|
19
|
+
|
20
|
+
To get started using the library, check out the [Getting Started](GettingStarted_md.html) guide.
|
21
|
+
|
22
|
+
|
23
|
+
## Prerequisites
|
24
|
+
|
25
|
+
* Ruby
|
26
|
+
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
$ gem install fluent_fixtures
|
31
|
+
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
You can check out the current development source with Mercurial via its
|
36
|
+
{project page}[http://bitbucket.org/ged/fluent_fixtures]. Or if you prefer Git, via
|
37
|
+
{its Github mirror}[https://github.com/ged/fluent_fixtures].
|
38
|
+
|
39
|
+
After checking out the source, run:
|
40
|
+
|
41
|
+
$ rake newb
|
42
|
+
|
43
|
+
This task will install any missing dependencies, run the tests/specs,
|
44
|
+
and generate the API documentation.
|
45
|
+
|
46
|
+
|
47
|
+
## License
|
48
|
+
|
49
|
+
Copyright (c) 2016, Michael Granger
|
50
|
+
All rights reserved.
|
51
|
+
|
52
|
+
Redistribution and use in source and binary forms, with or without
|
53
|
+
modification, are permitted provided that the following conditions are met:
|
54
|
+
|
55
|
+
* Redistributions of source code must retain the above copyright notice,
|
56
|
+
this list of conditions and the following disclaimer.
|
57
|
+
|
58
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
59
|
+
this list of conditions and the following disclaimer in the documentation
|
60
|
+
and/or other materials provided with the distribution.
|
61
|
+
|
62
|
+
* Neither the name of the author/s, nor the names of the project's
|
63
|
+
contributors may be used to endorse or promote products derived from this
|
64
|
+
software without specific prior written permission.
|
65
|
+
|
66
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
67
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
68
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
69
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
70
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
71
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
72
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
73
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
74
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
75
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
76
|
+
|
77
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'hoe'
|
5
|
+
rescue LoadError
|
6
|
+
abort "This Rakefile requires hoe (gem install hoe)"
|
7
|
+
end
|
8
|
+
|
9
|
+
GEMSPEC = 'fluent_fixtures.gemspec'
|
10
|
+
|
11
|
+
|
12
|
+
Hoe.plugin :mercurial
|
13
|
+
Hoe.plugin :signing
|
14
|
+
Hoe.plugin :deveiate
|
15
|
+
|
16
|
+
Hoe.plugins.delete :rubyforge
|
17
|
+
|
18
|
+
hoespec = Hoe.spec 'fluent_fixtures' do |spec|
|
19
|
+
spec.readme_file = 'README.md'
|
20
|
+
spec.history_file = 'History.md'
|
21
|
+
spec.extra_rdoc_files = FileList[ '*.rdoc', '*.md' ]
|
22
|
+
spec.license 'BSD-3-Clause'
|
23
|
+
spec.urls = {
|
24
|
+
home: 'http://deveiate.org/projects/fluent_fixtures',
|
25
|
+
code: 'http://bitbucket.org/ged/fluent_fixtures',
|
26
|
+
docs: 'http://deveiate.org/code/fluent_fixtures',
|
27
|
+
github: 'http://github.com/ged/fluent_fixtures',
|
28
|
+
}
|
29
|
+
|
30
|
+
spec.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
31
|
+
|
32
|
+
spec.dependency 'loggability', '~> 0.11'
|
33
|
+
spec.dependency 'inflecto', '~> 0.0'
|
34
|
+
|
35
|
+
spec.dependency 'faker', '~> 1.6', :developer
|
36
|
+
spec.dependency 'hoe-deveiate', '~> 0.3', :developer
|
37
|
+
spec.dependency 'simplecov', '~> 0.7', :developer
|
38
|
+
spec.dependency 'rdoc-generator-fivefish', '~> 0.1', :developer
|
39
|
+
|
40
|
+
spec.require_ruby_version( '>=2.2.0' )
|
41
|
+
spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
|
42
|
+
spec.check_history_on_release = true if spec.respond_to?( :check_history_on_release= )
|
43
|
+
|
44
|
+
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
ENV['VERSION'] ||= hoespec.spec.version.to_s
|
49
|
+
|
50
|
+
# Run the tests before checking in
|
51
|
+
task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
|
52
|
+
|
53
|
+
task :test => :spec
|
54
|
+
|
55
|
+
# Rebuild the ChangeLog immediately before release
|
56
|
+
task :prerelease => 'ChangeLog'
|
57
|
+
CLOBBER.include( 'ChangeLog' )
|
58
|
+
|
59
|
+
desc "Build a coverage report"
|
60
|
+
task :coverage do
|
61
|
+
ENV["COVERAGE"] = 'yes'
|
62
|
+
Rake::Task[:spec].invoke
|
63
|
+
end
|
64
|
+
CLOBBER.include( 'coverage' )
|
65
|
+
|
66
|
+
|
67
|
+
# Use the fivefish formatter for docs generated from development checkout
|
68
|
+
if File.directory?( '.hg' )
|
69
|
+
require 'rdoc/task'
|
70
|
+
|
71
|
+
Rake::Task[ 'docs' ].clear
|
72
|
+
RDoc::Task.new( 'docs' ) do |rdoc|
|
73
|
+
rdoc.main = "README.md"
|
74
|
+
rdoc.markup = 'markdown'
|
75
|
+
rdoc.rdoc_files.include( "*.md", "ChangeLog", "lib/**/*.rb" )
|
76
|
+
rdoc.generator = :fivefish
|
77
|
+
rdoc.title = 'fluent_fixtures'
|
78
|
+
rdoc.rdoc_dir = 'doc'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
task :gemspec => GEMSPEC
|
83
|
+
file GEMSPEC => __FILE__
|
84
|
+
task GEMSPEC do |task|
|
85
|
+
spec = $hoespec.spec
|
86
|
+
spec.files.delete( '.gemtest' )
|
87
|
+
spec.signing_key = nil
|
88
|
+
spec.cert_chain = ['certs/ged.pem']
|
89
|
+
spec.version = "#{spec.version}.pre.#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
90
|
+
puts "Spec version is set to: %s" % [ spec.version ]
|
91
|
+
File.open( task.name, 'w' ) do |fh|
|
92
|
+
fh.write( spec.to_ruby )
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
CLOBBER.include( GEMSPEC.to_s )
|
97
|
+
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
require 'inflecto'
|
5
|
+
require 'loggability'
|
6
|
+
|
7
|
+
require 'fluent_fixtures' unless defined?( FluentFixtures )
|
8
|
+
|
9
|
+
|
10
|
+
# Extension module for fixture collection modules
|
11
|
+
module FluentFixtures::Collection
|
12
|
+
extend Loggability
|
13
|
+
|
14
|
+
|
15
|
+
# The glob pattern to use when matching files in the search_path.
|
16
|
+
FIXTURE_FILE_PATTERN = '*.rb'
|
17
|
+
|
18
|
+
|
19
|
+
# Loggability API -- log to the FluentFixtures logger
|
20
|
+
log_to :fluent_fixtures
|
21
|
+
|
22
|
+
|
23
|
+
### Extension callback for the +collection_mod+. Sets up data structures for new
|
24
|
+
### +collection_mod+s.
|
25
|
+
def self::extended( collection_mod )
|
26
|
+
super
|
27
|
+
|
28
|
+
prefix = collection_mod.name || nil
|
29
|
+
prefix &&= prefix.sub( /::.*\z/, '' ).downcase
|
30
|
+
default_fixture_path_prefix = File.join( *[prefix, 'fixtures'].compact )
|
31
|
+
|
32
|
+
collection_mod.extend( Loggability )
|
33
|
+
collection_mod.log_to( :fluent_fixtures )
|
34
|
+
|
35
|
+
collection_mod.instance_variable_set( :@modules, {} )
|
36
|
+
collection_mod.instance_variable_set( :@fixture_path_prefix, default_fixture_path_prefix )
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
##
|
41
|
+
# The Hash of fixture modules declared within this Collection
|
42
|
+
attr_reader :modules
|
43
|
+
|
44
|
+
|
45
|
+
### Declare one or more +prefixes+ to use when searching for fixtures to load
|
46
|
+
### for the Collection.
|
47
|
+
def fixture_path_prefix( new_prefix=nil )
|
48
|
+
@fixture_path_prefix = new_prefix if new_prefix
|
49
|
+
return @fixture_path_prefix
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
### Load fixtures of the specified +types+.
|
54
|
+
def load( *types )
|
55
|
+
types.each do |type|
|
56
|
+
requirename = File.join( self.fixture_path_prefix, type.to_s )
|
57
|
+
require( requirename )
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
### Load all available fixture modules from loaded gems.
|
63
|
+
def load_all
|
64
|
+
pattern = File.join( self.fixture_path_prefix, FIXTURE_FILE_PATTERN )
|
65
|
+
Gem.find_files( pattern ).each do |fixture_path|
|
66
|
+
fixture_name = File.basename( fixture_path, '.rb' )
|
67
|
+
self.load( fixture_name )
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
### Extension callback -- add some stuff to every fixture module. Note that this is called
|
73
|
+
### by fixtures which extend a collection module, not by the collection itself.
|
74
|
+
def extended( fixture_mod )
|
75
|
+
super
|
76
|
+
|
77
|
+
fixture_mod.extend( Loggability )
|
78
|
+
fixture_mod.log_to( :fluent_fixtures )
|
79
|
+
|
80
|
+
fixture_mod.extend( FluentFixtures::DSL )
|
81
|
+
fixture_mod.instance_variable_set( :@decorators, {} )
|
82
|
+
fixture_mod.instance_variable_set( :@fixtured_class, nil )
|
83
|
+
fixture_mod.instance_variable_set( :@base_fixture, nil )
|
84
|
+
|
85
|
+
fixture_mod.collection = self
|
86
|
+
|
87
|
+
if default_name = self.default_base_fixture_name( fixture_mod )
|
88
|
+
self.add_base_fixture( default_name, fixture_mod )
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
### Add a global fixture method with the specified +name+ to the top-level
|
94
|
+
### Fixtures module.
|
95
|
+
def add_base_fixture( name, fixture_mod )
|
96
|
+
self.log.debug "Adding a base fixture to %p: %p as %p" % [ self, fixture_mod, name ]
|
97
|
+
|
98
|
+
if previous_name = self.modules.key( fixture_mod )
|
99
|
+
self.modules.delete( previous_name )
|
100
|
+
# ugh, no remove_singleton_method
|
101
|
+
self.singleton_class.instance_exec( previous_name ) do |methodname|
|
102
|
+
remove_method( methodname )
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if self.modules.key?( name )
|
107
|
+
raise ScriptError,
|
108
|
+
"Already have a base fixture called %s: %p" % [ name, self.modules[name] ]
|
109
|
+
end
|
110
|
+
|
111
|
+
self.modules[ name ] = fixture_mod
|
112
|
+
define_singleton_method( name, &fixture_mod.method(:factory) )
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
### Return the default base fixture name based on the name of the given +mod+ (a Module).
|
117
|
+
def default_base_fixture_name( mod )
|
118
|
+
modname = mod.name or return nil
|
119
|
+
name = Inflecto.singularize( Inflecto.demodulize(modname).downcase )
|
120
|
+
return name.to_sym
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
### Clear all declared fixtures from the Cozy::FluentFixtures namespace. Mostly used for
|
125
|
+
### testing the fixtures system itself.
|
126
|
+
def reset!
|
127
|
+
self.modules.each do |name, mod|
|
128
|
+
self.log.warn "Removing base fixture method for %p: %p" % [ mod, name ]
|
129
|
+
self.singleton_class.instance_exec( name ) do |methodname|
|
130
|
+
remove_method( methodname ) if method_defined?( methodname )
|
131
|
+
end
|
132
|
+
end
|
133
|
+
self.modules.clear
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
end # module FluentFixtures::Collection
|