Module: FixtureBot::Helpers

Included in:
FixtureCreator
Defined in:
lib/fixture_bot/helpers.rb

Class Method Summary collapse

Class Method Details

.included(_base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fixture_bot/helpers.rb', line 5

def self.included(_base)
  ::FixtureBot::FixtureCreator.tables.each_key do |table|
    module_eval <<-RUBY, __FILE__, __LINE__ + 1
      # def users(name)
      #   fixture_get(name, :users)
      # end
      def #{table}(name)
        fixture_get(name, :#{table})
      end
    RUBY
  end
end