Skip to content

Instantly share code, notes, and snippets.

View j16r's full-sized avatar
😑

John Barker j16r

😑
  • Colorado
View GitHub Profile
@j16r
j16r / assert_on_methods.go
Created November 19, 2018 22:35 — forked from dimroc/assert_on_methods.go
Finding it hard to shoe horn into table driven tests
func TestHeightsController_Index(t *testing.T) {
threshold := big.NewInt(2)
tests := []struct {
name string
status int
}{
{"good clients", 200},
// Hard to do error cases without adding an if with difference setup. could add test helpers...
}
def diff(a, b, file = "current.diff")
require 'rspec/expectations/differ'
differ = RSpec::Expectations::Differ.new
diff = differ.diff_as_object(a, b)
File.open(file, "w+") { |f| f.write diff }
system "mate", file
end