Last active
December 29, 2015 17:49
-
-
Save sinsoku/7707168 to your computer and use it in GitHub Desktop.
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 Sample | |
class << self | |
def run | |
puts "hello, #{gets}" | |
puts "hello, #{gets}" | |
end | |
end | |
end | |
if __FILE__ == $0 | |
Sample.run | |
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_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