Skip to content

Commit

Permalink
Simplify fixture filename logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Apr 7, 2017
1 parent a799588 commit 3cff75d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/fixture_dependencies.rb
Expand Up @@ -106,11 +106,8 @@ def get(record)
def load_yaml(model_name)
raise(ArgumentError, "No fixture_path set. Use FixtureDependencies.fixture_path = ...") unless fixture_path

if model_class(model_name).respond_to?(:fixture_filename)
filename = model_class(model_name).fixture_filename
else
filename = model_class(model_name).table_name
end
klass = model_class(model_name)
filename = klass.send(klass.respond_to?(:fixture_filename) ? :fixture_filename : :table_name)
yaml_path = File.join(fixture_path, "#{filename}.yml")

if File.exist?(yaml_path)
Expand Down

0 comments on commit 3cff75d

Please sign in to comment.