Skip to content

Instantly share code, notes, and snippets.

@sinsoku
Last active December 29, 2015 17:49
Show Gist options
  • Save sinsoku/7707168 to your computer and use it in GitHub Desktop.
Save sinsoku/7707168 to your computer and use it in GitHub Desktop.
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