spec/cli_spec.rb in rubyc-0.1.0 vs spec/cli_spec.rb in rubyc-0.1.1
- old
+ new
@@ -20,14 +20,21 @@
@cli.select('l =~ /Jack/ && lnum == 2 && index == 1')
end
out_str.must_equal "Black Jack\n"
end
+ it "should reject line from stdin and send it to stdout" do
+ out_str = local_io("John Doe\nBlack Jack\nDr Dolittle\nCracker Jack") do
+ @cli.reject('l =~ /Jack/ && lnum == 2 && index == 1')
+ end
+ out_str.must_equal "John Doe\nDr Dolittle\nCracker Jack\n"
+ end
+
it "should sum line from stdin and send it to stdout" do
out_str = local_io("1\n2\nthird\n4") do
@cli.sum('l.to_i * 2')
end
- out_str.must_equal "14.0\n"
+ out_str.must_equal "14\n"
end
it "should sort by stdin and send the result to stdout" do
out_str = local_io("a\nbbb\ncc\ndddd") do
@cli.sort_by('l.length')