Skip to content

Instantly share code, notes, and snippets.

@lockwooddev
Created February 17, 2021 10:04
Show Gist options
  • Save lockwooddev/4dc843035ec2d89a4af6c866196f4a34 to your computer and use it in GitHub Desktop.
Save lockwooddev/4dc843035ec2d89a4af6c866196f4a34 to your computer and use it in GitHub Desktop.
type MockRobotsClient struct {
iter int64
Mocks []RobotRules
}
func NewMockRobotsClient(mocks []RobotRules) Roboteer {
return &MockRobotsClient{Mocks: mocks}
}
func (m *MockRobotsClient) FetchRobots(url string) (RobotRules, error) {
mock := m.Mocks[m.iter]
m.iter++
return mock, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment