blue-shell 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,6 +36,14 @@ module BlueShell
36
36
  @stdin.print("\e[A")
37
37
  end
38
38
 
39
+ def send_right_arrow
40
+ @stdin.print("\e[C")
41
+ end
42
+
43
+ def send_backspace
44
+ @stdin.print("\b \b")
45
+ end
46
+
39
47
  def send_keys(text_to_send)
40
48
  @stdin.puts(text_to_send)
41
49
  end
@@ -1,3 +1,3 @@
1
1
  module BlueShell
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
@@ -180,6 +180,28 @@ module BlueShell
180
180
  end
181
181
  end
182
182
 
183
+ describe "#send_right_arrow" do
184
+ it "sends a right arrow key press and expects more output afterwards" do
185
+ BlueShell::Runner.run("ruby #{asset("unbuffered_input.rb")} #{EscapedKeys::KEY_RIGHT}") do |runner|
186
+ expect(runner.expect("started")).to be_true
187
+ runner.send_right_arrow
188
+ expect(runner.expect('received: "\e[C"')).to be_true
189
+ end
190
+ end
191
+ end
192
+
193
+ describe "#send_backspace" do
194
+ it "sends a backspace key press and expects a character to be deleted" do
195
+ BlueShell::Runner.run("ruby #{asset("input.rb")}") do |runner|
196
+ expect(runner.expect("started")).to be_true
197
+ runner.send_keys "foo"
198
+ runner.send_backspace
199
+ runner.send_return
200
+ expect(runner.expect('received fo')).to be_true
201
+ end
202
+ end
203
+ end
204
+
183
205
  context "#exit_code" do
184
206
  it "returns the exit code" do
185
207
  BlueShell::Runner.run("ruby -e 'exit 42'") do |runner|
@@ -1,3 +1,4 @@
1
1
  module EscapedKeys
2
2
  KEY_UP = "[A"
3
+ KEY_RIGHT = "[C"
3
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blue-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-18 00:00:00.000000000 Z
13
+ date: 2013-08-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec