Skip to content

Commit

Permalink
Fixes error for StdErr.puts <number>
Browse files Browse the repository at this point in the history
error: String can't be coerced into Fixnum (TypeError)
  • Loading branch information
mattscilipoti committed May 17, 2011
1 parent 95f8488 commit 12f8887
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kidsruby/stdio.rb
Expand Up @@ -22,7 +22,7 @@ def write(data)
end

def puts(data)
write(data + "\n")
write(data.to_s + "\n")
end
end

Expand Down
9 changes: 9 additions & 0 deletions spec/models/std_io_spec.rb
Expand Up @@ -11,3 +11,12 @@
end
end

describe StdErr do
describe ".puts" do
it "should delegate the coerced, newlined data to .write" do
stderr_ut = StdErr.new
stderr_ut.expects(:write).with("234\n")
stderr_ut.puts(234)
end
end
end

0 comments on commit 12f8887

Please sign in to comment.