cancun 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cancun/test.rb +7 -1
- data/lib/cancun/version.rb +1 -1
- data/spec/lib/cancun_spec.rb +10 -1
- metadata +1 -1
data/lib/cancun/test.rb
CHANGED
@@ -28,6 +28,9 @@ class Cancun
|
|
28
28
|
@output << @output_read.dup.read_nonblock(4096) rescue Errno::EAGAIN
|
29
29
|
@output
|
30
30
|
end
|
31
|
+
def execute!(&cmd)
|
32
|
+
TestCase.new(self).execute!(&cmd)
|
33
|
+
end
|
31
34
|
|
32
35
|
|
33
36
|
class TestCase
|
@@ -40,7 +43,10 @@ class Cancun
|
|
40
43
|
self
|
41
44
|
end
|
42
45
|
|
43
|
-
def
|
46
|
+
def execute!(&block)
|
47
|
+
execute(&block)
|
48
|
+
run
|
49
|
+
sleep 0.01
|
44
50
|
end
|
45
51
|
|
46
52
|
def and_type(*args)
|
data/lib/cancun/version.rb
CHANGED
data/spec/lib/cancun_spec.rb
CHANGED
@@ -2,13 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'cancun spec' do
|
4
4
|
include Cancun::Test
|
5
|
+
|
5
6
|
before{ init_cancun_test }
|
6
7
|
|
7
|
-
it '
|
8
|
+
it 'should let you type args' do
|
8
9
|
execute do
|
9
10
|
Foo.new.salute
|
10
11
|
end.and_type 'bonzo'
|
11
12
|
expect(output).to include('Hi bonzo')
|
12
13
|
end
|
14
|
+
|
15
|
+
it 'should let you execute without typing' do
|
16
|
+
execute! do
|
17
|
+
Foo.new.salute
|
18
|
+
end
|
19
|
+
expect(output).to include('what is your name?')
|
20
|
+
end
|
13
21
|
end
|
14
22
|
|
23
|
+
|