This file contains 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
#include <sys/time.h> | |
#include <sys/wait.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define C99 | |
struct timeval tv; | |
time_t curtime; |
This file contains 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 MiniStub | |
def initialize *args | |
unless args.first.is_a? Hash | |
@name = args.shift | |
end | |
@stubbed = args.first || {} | |
end | |
def inspect | |
"#<MiniStub(#{@name})>" |
This file contains 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
#!/usr/bin/env ruby | |
# Encoding: UTF-8 | |
require 'socket' | |
def listening? host, port | |
TCPSocket.open(host, port)#.close | |
true | |
rescue | |
false | |
end |
This file contains 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 'zeus/rails' | |
class CustomPlan < Zeus::Rails | |
def test_environment | |
require 'minitest/unit' | |
MiniTest::Unit.class_variable_set('@@installed_at_exit', true) | |
super | |
end | |
end |
This file contains 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
gem 'minitest', '>= 5' | |
require 'minitest/autorun' | |
module Kernel | |
def private_def method_name, &block | |
define_method method_name, &block | |
private method_name | |
end | |
end |
This file contains 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 'unicode_utils' | |
baffle = 'baffle' | |
puts baffle # => baffle | |
puts baffle.upcase # => BAfflE | |
puts UnicodeUtils.upcase(baffle) # => BAFFLE | |
noel = 'noël' |
This file contains 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 Collaborator | |
# not implemented yet because TDD! | |
end | |
class ThingThatDoesThings | |
def initialize name | |
@name = name | |
end | |
def do_thing with |
This file contains 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
source 'https://rubygems.org' | |
gem 'fruity', '~> 0.2.0' | |
gem 'rubyzip', '1.1.0' | |
gem 'zippo', '0.2.0' |
This file contains 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 "i18n/backend/fallbacks" | |
I18n::Backend::Simple.send :include, I18n::Backend::Fallbacks | |
I18n.backend.store_translations :en, test: { | |
no_translations: { | |
specific: "en specific", | |
generic: "en generic", | |
}, | |
only_generic_translations: { |
This file contains 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 'test_helper' | |
class MiniTestDoesntWorkWithUnenumerableRangesTest < ActiveSupport::TestCase | |
test ":(" do | |
period = Time.current - 1.week .. Time.current | |
mock = MiniTest::Mock.new | |
mock.expect :foo, true, [period] | |
mock.foo period |