module FixtureOverlord::FixtureAccessor
Public Instance Methods
fixture_overlord(setting = nil)
click to toggle source
# File lib/fixture_overlord/fixture_accessor.rb, line 9 def fixture_overlord(setting = nil) return unless setting.to_sym == :rule yaml_files.each do |yaml| # creates the hash version of the model define_method(yaml_filename(yaml)) do |key| hash = FixtureOverlord.read_fixture(yaml, key) hash.yaml_file = Helpers.yaml_filename(yaml) hash end end end
root()
click to toggle source
# File lib/fixture_overlord/fixture_accessor.rb, line 23 def root @root ||= ::Pathname.new(Dir.pwd) end
Private Instance Methods
yaml_filename(file)
click to toggle source
reading the yaml filename
# File lib/fixture_overlord/fixture_accessor.rb, line 35 def yaml_filename(file) ::File.basename(file).split('.').first end
yaml_files()
click to toggle source
glob all yml files from their respective fixtures location
# File lib/fixture_overlord/fixture_accessor.rb, line 30 def yaml_files Dir.glob(root.join("{test,spec}/fixtures/**/*.{yaml,yml}").to_s) end