Class: Taza::Fixture
Overview
:nodoc:
Instance Method Summary collapse
-
#base_path ⇒ Object
:nodoc:.
-
#fixture_names ⇒ Object
:nodoc:.
-
#fixtures_pattern ⇒ Object
:nodoc:.
-
#get_fixture_entity(fixture_file_key, entity_key) ⇒ Object
:nodoc:.
-
#initialize ⇒ Fixture
constructor
:nodoc:.
-
#load_all ⇒ Object
:nodoc:.
-
#pluralized_fixture_exists?(singularized_fixture_name) ⇒ Boolean
:nodoc:.
Constructor Details
#initialize ⇒ Fixture
:nodoc:
4 5 6 |
# File 'lib/taza/fixture.rb', line 4 def initialize # :nodoc: @fixtures = {} end |
Instance Method Details
#base_path ⇒ Object
:nodoc:
34 35 36 |
# File 'lib/taza/fixture.rb', line 34 def base_path # :nodoc: File.join('.','spec') end |
#fixture_names ⇒ Object
:nodoc:
18 19 20 |
# File 'lib/taza/fixture.rb', line 18 def fixture_names # :nodoc: @fixtures.keys end |
#fixtures_pattern ⇒ Object
:nodoc:
30 31 32 |
# File 'lib/taza/fixture.rb', line 30 def fixtures_pattern # :nodoc: File.join(base_path, 'fixtures','*.yml') end |
#get_fixture_entity(fixture_file_key, entity_key) ⇒ Object
:nodoc:
22 23 24 |
# File 'lib/taza/fixture.rb', line 22 def get_fixture_entity(fixture_file_key,entity_key) # :nodoc: @fixtures[fixture_file_key][entity_key] end |
#load_all ⇒ Object
:nodoc:
8 9 10 11 12 13 14 15 16 |
# File 'lib/taza/fixture.rb', line 8 def load_all # :nodoc: Dir.glob(fixtures_pattern) do |file| entitized_fixture = {} YAML.load_file(file).each do |key, value| entitized_fixture[key] = value.convert_hash_keys_to_methods(self) end @fixtures[File.basename(file,'.yml').to_sym] = entitized_fixture end end |
#pluralized_fixture_exists?(singularized_fixture_name) ⇒ Boolean
:nodoc:
26 27 28 |
# File 'lib/taza/fixture.rb', line 26 def pluralized_fixture_exists?(singularized_fixture_name) # :nodoc: fixture_names.include?(singularized_fixture_name.pluralize_to_sym) end |