Skip to content

Instantly share code, notes, and snippets.

@sinsoku
Last active Dec 29, 2015
Embed
What would you like to do?
class Sample
class << self
def run
puts "hello, #{gets}"
puts "hello, #{gets}"
end
end
end
if __FILE__ == $0
Sample.run
end
require_relative 'sample'
describe Sample do
describe ".run" do
describe "example.1" do
let(:input) { ['nanoha', 'fate'] }
let(:output) { ['hello, nanoha', 'hello, fate'] }
before do
Sample.stub(:gets).and_return(*input)
output.each { |x| Sample.should_receive(:puts).with(x) }
end
it { Sample.run }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment