Skip to content

Instantly share code, notes, and snippets.

@johncip johncip/print_fixtures.rb
Last active Feb 17, 2016

Embed
What would you like to do?
Print fixtures used
log = StringIO.new
ActiveRecord::Base.logger = Logger.new(log)
Gradescope::Application.config.colorize_logging = false
RSpec.configure do |config|
config.after :suite do
lines = log.tap(&:rewind).readlines.to_a
matching = lines.map do |line|
next unless line =~ /Load/
next if line =~ /SchemaMigration/
line.match(/(\w+) Load/)[1]
end
table_names = matching.uniq.compact.map do |x|
x.underscore.pluralize.to_sym
end
puts "fixtures #{table_names.inspect}\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.