- Run for length of time
- Run for number of iterations
- Run for both and stop at whichever comes first
- Reuse RSpec structure
- Running semantics:
- I want to run for N iterations limited to X minutes in CI
- I want to run for a few seconds with rake
- I want to run for a shorter period of time with guard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## x27[32mmasterx27[m...x27[31morigin/masterx27[m [ahead x27[32m1x27[m] | |
## x27[32mmasterx27[m...x27[31morigin/masterx27[m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rg | |
from random import choice | |
class Robot: | |
def act(self, game): | |
ranges = [-1, 0, 1] | |
x = self.location[0] + choice(ranges) | |
y = self.location[1] + choice(ranges) | |
moves = [ | |
['move', (x, y)], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'mrproper' | |
properties 'String' do | |
data string: String, wrap_at: Integer | |
property '#wrap' do |data| | |
assert_not_empty data[:string].wrap(data[:wrap_at]) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Temperature | |
DEGREE_SIGN = "°" | |
attr_reader :value, :scale | |
def initialize(value, scale) | |
@value = value.to_f.round(1) | |
@scale = TemperatureScale.from_symbol(scale) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Temperature | |
DEGREE_SIGN = "°" | |
attr_reader :value, :scale | |
def initialize(value, scale) | |
@value = value.to_f.round(1) | |
@scale = TemperatureScale.from_symbol(scale) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Temperature | |
attr_reader :value, :scale | |
def initialize(value, scale = :farenheit) | |
@value = Float(value) | |
@scale = scale | |
end | |
def to_celcius | |
return self if scale == :celcius |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def new(klass, *args) | |
klass.new(*args) | |
end | |
(p (new String)) # => "" | |
def concat(*strings) | |
strings.join | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module | |
def callable | |
klass_name = if defined?(:caller_locations) | |
caller_locations(1, 1)[0].label[8..-2] | |
else | |
caller[0][/`.*'/][9..-3] | |
end | |
klass = Kernel.const_get(klass_name) |