spec/cmds/capture_spec.rb in cmds-0.1.5 vs spec/cmds/capture_spec.rb in cmds-0.2.0
- old
+ new
@@ -1,17 +1,17 @@
require 'spec_helper'
describe "Cmds::capture" do
it "captures stdout" do
expect(
- Cmds::Cmd.new(%{ruby -e '$stdout.puts "hey"'}).capture.out
+ Cmds.new(%{ruby -e '$stdout.puts "hey"'}).capture.out
).to eq "hey\n"
end
it "captures stderr" do
expect(
- Cmds::Cmd.new(%{ruby -e '$stderr.puts "ho"'}).capture.err
+ Cmds.new(%{ruby -e '$stderr.puts "ho"'}).capture.err
).to eq "ho\n"
end
context "echo_cmd.rb 'hello world!'" do
@@ -40,12 +40,12 @@
end
end # context echo_cmd.rb 'hello world!'
it "is reusable" do
- args_cmd = Cmds::Cmd.new "./test/echo_cmd.rb <%= arg %>"
- kwds_cmd = Cmds::Cmd.new "./test/echo_cmd.rb <%= s %>"
+ args_cmd = Cmds.new "./test/echo_cmd.rb <%= arg %>"
+ kwds_cmd = Cmds.new "./test/echo_cmd.rb <%= s %>"
args = ["arg one", "arg two", "arg three"]
args.each do |arg|
results = [
@@ -68,24 +68,24 @@
four!
BLOCK
}
it "accepts input via options" do
- cmd = Cmds::Cmd.new(ECHO_CMD, input: input)
+ cmd = Cmds.new(ECHO_CMD, input: input)
expect( echo_cmd_stdin cmd.capture ).to eq input
end
it "accepts input via block" do
- cmd = Cmds::Cmd.new ECHO_CMD
+ cmd = Cmds.new ECHO_CMD
expect( echo_cmd_stdin cmd.capture { input } ).to eq input
end
it "accepts input from a stream" do
File.open "./test/lines.txt" do |f|
input = f.read
f.rewind
- cmd = Cmds::Cmd.new ECHO_CMD
+ cmd = Cmds.new ECHO_CMD
expect( echo_cmd_stdin cmd.capture { f } ).to eq input
end
end
end # context input
end # Cmds::capture
\ No newline at end of file