Skip to content

Instantly share code, notes, and snippets.

@jonahgeorge
Created September 19, 2015 23:18
Show Gist options
  • Save jonahgeorge/d0898cc3b5a00f40f291 to your computer and use it in GitHub Desktop.
Save jonahgeorge/d0898cc3b5a00f40f291 to your computer and use it in GitHub Desktop.
Generates Capybara tests for the rails_admin index page for all models.
models = Dir.glob("*.rb")
def spec(model)
template = <<-END
scenario "#{model}" do
visit rails_admin.index_path(model_name: "#{model}")
page.status_code.must_equal 200
page.assert_current_path rails_admin.index_path(model_name: "#{model}")
end
END
end
models.each do |model|
puts spec(model.gsub(".rb", ""))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment