aruba 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +8 -0
- data/Rakefile +1 -1
- data/aruba.gemspec +7 -4
- data/features/exit_statuses.feature +2 -1
- data/features/output.feature +11 -0
- data/features/support/env.rb +7 -1
- data/lib/aruba.rb +1 -114
- data/lib/aruba/api.rb +57 -0
- data/lib/aruba/cucumber.rb +76 -0
- metadata +31 -13
data/History.txt
ADDED
data/Rakefile
CHANGED
data/aruba.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{aruba}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aslak Helles\303\270y", "David Chelimsky"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-23}
|
13
13
|
s.description = %q{CLI Steps for Cucumber, hand-crafted for you in Aruba}
|
14
14
|
s.email = %q{cukes@groups.google.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
"History.txt",
|
22
23
|
"LICENSE",
|
23
24
|
"README.rdoc",
|
24
25
|
"Rakefile",
|
@@ -28,12 +29,14 @@ Gem::Specification.new do |s|
|
|
28
29
|
"features/output.feature",
|
29
30
|
"features/step_definitions/aruba_steps.rb",
|
30
31
|
"features/support/env.rb",
|
31
|
-
"lib/aruba.rb"
|
32
|
+
"lib/aruba.rb",
|
33
|
+
"lib/aruba/api.rb",
|
34
|
+
"lib/aruba/cucumber.rb"
|
32
35
|
]
|
33
36
|
s.homepage = %q{http://github.com/aslakhellesoy/aruba}
|
34
37
|
s.rdoc_options = ["--charset=UTF-8"]
|
35
38
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.
|
39
|
+
s.rubygems_version = %q{1.3.6}
|
37
40
|
s.summary = %q{CLI Steps for Cucumber}
|
38
41
|
|
39
42
|
if s.respond_to? :specification_version then
|
data/features/output.feature
CHANGED
@@ -8,6 +8,10 @@ Feature: Output
|
|
8
8
|
When I run "ruby -e 'puts \"hello world\"'"
|
9
9
|
Then I should see "hello world"
|
10
10
|
|
11
|
+
Scenario: Detect absence of one-line output
|
12
|
+
When I run "ruby -e 'puts \"hello world\"'"
|
13
|
+
Then I should not see "good-bye"
|
14
|
+
|
11
15
|
Scenario: Detect subset of multiline output
|
12
16
|
When I run "ruby -e 'puts \"hello\nworld\"'"
|
13
17
|
Then I should see:
|
@@ -15,6 +19,13 @@ Feature: Output
|
|
15
19
|
hello
|
16
20
|
"""
|
17
21
|
|
22
|
+
Scenario: Detect subset of multiline output
|
23
|
+
When I run "ruby -e 'puts \"hello\nworld\"'"
|
24
|
+
Then I should not see:
|
25
|
+
"""
|
26
|
+
good-bye
|
27
|
+
"""
|
28
|
+
|
18
29
|
Scenario: Detect exact one-line output
|
19
30
|
When I run "ruby -e 'puts \"hello world\"'"
|
20
31
|
Then I should see exactly "hello world\n"
|
data/features/support/env.rb
CHANGED
data/lib/aruba.rb
CHANGED
@@ -1,114 +1 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
module ArubaWorld
|
4
|
-
def in_current_dir(&block)
|
5
|
-
_mkdir(current_dir)
|
6
|
-
Dir.chdir(current_dir, &block)
|
7
|
-
end
|
8
|
-
|
9
|
-
def current_dir
|
10
|
-
'tmp/aruba'
|
11
|
-
end
|
12
|
-
|
13
|
-
def create_file(file_name, file_content)
|
14
|
-
in_current_dir do
|
15
|
-
_mkdir(File.dirname(file_name))
|
16
|
-
File.open(file_name, 'w') { |f| f << file_content }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def create_dir(dir_name)
|
21
|
-
in_current_dir do
|
22
|
-
_mkdir(dir_name)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def _mkdir(dir_name)
|
27
|
-
FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
|
28
|
-
end
|
29
|
-
|
30
|
-
def unescape(string)
|
31
|
-
eval(%{"#{string}"})
|
32
|
-
end
|
33
|
-
|
34
|
-
def combined_output
|
35
|
-
@last_stdout + (@last_stderr == '' ? '' : "\n#{'-'*70}\n#{@last_stderr}")
|
36
|
-
end
|
37
|
-
|
38
|
-
def run(command)
|
39
|
-
stderr_file = Tempfile.new('cucumber')
|
40
|
-
stderr_file.close
|
41
|
-
in_current_dir do
|
42
|
-
mode = Cucumber::RUBY_1_9 ? {:external_encoding=>"UTF-8"} : 'r'
|
43
|
-
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
|
44
|
-
@last_stdout = io.read
|
45
|
-
end
|
46
|
-
|
47
|
-
@last_exit_status = $?.exitstatus
|
48
|
-
end
|
49
|
-
@last_stderr = IO.read(stderr_file.path)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
World(ArubaWorld)
|
54
|
-
|
55
|
-
Before do
|
56
|
-
FileUtils.rm_rf(current_dir)
|
57
|
-
end
|
58
|
-
|
59
|
-
Given /^a directory named "([^\"]*)"$/ do |dir_name|
|
60
|
-
create_dir(dir_name)
|
61
|
-
end
|
62
|
-
|
63
|
-
Given /^a file named "([^\"]*)" with:$/ do |file_name, file_content|
|
64
|
-
create_file(file_name, file_content)
|
65
|
-
end
|
66
|
-
|
67
|
-
When /^I run "(.*)"$/ do |cmd|
|
68
|
-
run(unescape(cmd))
|
69
|
-
end
|
70
|
-
|
71
|
-
Then /^I should see "([^\"]*)"$/ do |partial_output|
|
72
|
-
combined_output.should =~ /#{partial_output}/
|
73
|
-
end
|
74
|
-
|
75
|
-
Then /^I should see:$/ do |partial_output|
|
76
|
-
combined_output.should =~ /#{partial_output}/
|
77
|
-
end
|
78
|
-
|
79
|
-
Then /^I should see exactly "([^\"]*)"$/ do |exact_output|
|
80
|
-
combined_output.should == unescape(exact_output)
|
81
|
-
end
|
82
|
-
|
83
|
-
Then /^I should see exactly:$/ do |exact_output|
|
84
|
-
combined_output.should == exact_output
|
85
|
-
end
|
86
|
-
|
87
|
-
Then /^the exit status should be (\d+)$/ do |exit_status|
|
88
|
-
@last_exit_status.should == exit_status.to_i
|
89
|
-
end
|
90
|
-
|
91
|
-
Then /^it should (pass|fail) with:$/ do |pass_fail, partial_output|
|
92
|
-
if pass_fail == 'pass'
|
93
|
-
@last_exit_status.should == 0
|
94
|
-
else
|
95
|
-
@last_exit_status.should_not == 0
|
96
|
-
end
|
97
|
-
Then "I should see:", partial_output
|
98
|
-
end
|
99
|
-
|
100
|
-
Then /^the stderr should contain "([^\"]*)"$/ do |partial_output|
|
101
|
-
@last_stderr.should =~ /#{partial_output}/
|
102
|
-
end
|
103
|
-
|
104
|
-
Then /^the stdout should contain "([^\"]*)"$/ do |partial_output|
|
105
|
-
@last_stdout.should =~ /#{partial_output}/
|
106
|
-
end
|
107
|
-
|
108
|
-
Then /^the stderr should not contain "([^\"]*)"$/ do |partial_output|
|
109
|
-
@last_stderr.should_not =~ /#{partial_output}/
|
110
|
-
end
|
111
|
-
|
112
|
-
Then /^the stdout should not contain "([^\"]*)"$/ do |partial_output|
|
113
|
-
@last_stdout.should_not =~ /#{partial_output}/
|
114
|
-
end
|
1
|
+
require 'aruba/cucumber'
|
data/lib/aruba/api.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
module Aruba
|
4
|
+
module Api
|
5
|
+
def in_current_dir(&block)
|
6
|
+
_mkdir(current_dir)
|
7
|
+
Dir.chdir(current_dir, &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def current_dir
|
11
|
+
'tmp/aruba'
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_file(file_name, file_content)
|
15
|
+
in_current_dir do
|
16
|
+
_mkdir(File.dirname(file_name))
|
17
|
+
File.open(file_name, 'w') { |f| f << file_content }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_dir(dir_name)
|
22
|
+
in_current_dir do
|
23
|
+
_mkdir(dir_name)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def _mkdir(dir_name)
|
28
|
+
FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def unescape(string)
|
32
|
+
eval(%{"#{string}"})
|
33
|
+
end
|
34
|
+
|
35
|
+
def compile_and_escape(string)
|
36
|
+
Regexp.compile(Regexp.escape(string))
|
37
|
+
end
|
38
|
+
|
39
|
+
def combined_output
|
40
|
+
@last_stdout + (@last_stderr == '' ? '' : "\n#{'-'*70}\n#{@last_stderr}")
|
41
|
+
end
|
42
|
+
|
43
|
+
def run(command)
|
44
|
+
stderr_file = Tempfile.new('cucumber')
|
45
|
+
stderr_file.close
|
46
|
+
in_current_dir do
|
47
|
+
mode = RUBY_VERSION =~ /^1\.9/ ? {:external_encoding=>"UTF-8"} : 'r'
|
48
|
+
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
|
49
|
+
@last_stdout = io.read
|
50
|
+
end
|
51
|
+
|
52
|
+
@last_exit_status = $?.exitstatus
|
53
|
+
end
|
54
|
+
@last_stderr = IO.read(stderr_file.path)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'aruba/api'
|
2
|
+
|
3
|
+
World(Aruba::Api)
|
4
|
+
|
5
|
+
Before do
|
6
|
+
FileUtils.rm_rf(current_dir)
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^a directory named "([^\"]*)"$/ do |dir_name|
|
10
|
+
create_dir(dir_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^a file named "([^\"]*)" with:$/ do |file_name, file_content|
|
14
|
+
create_file(file_name, file_content)
|
15
|
+
end
|
16
|
+
|
17
|
+
When /^I run "(.*)"$/ do |cmd|
|
18
|
+
run(unescape(cmd))
|
19
|
+
end
|
20
|
+
|
21
|
+
Then /^I should see "([^\"]*)"$/ do |partial_output|
|
22
|
+
combined_output.should =~ compile_and_escape(partial_output)
|
23
|
+
end
|
24
|
+
|
25
|
+
Then /^I should not see "([^\"]*)"$/ do |partial_output|
|
26
|
+
combined_output.should_not =~ compile_and_escape(partial_output)
|
27
|
+
end
|
28
|
+
|
29
|
+
Then /^I should see:$/ do |partial_output|
|
30
|
+
combined_output.should =~ compile_and_escape(partial_output)
|
31
|
+
end
|
32
|
+
|
33
|
+
Then /^I should not see:$/ do |partial_output|
|
34
|
+
combined_output.should_not =~ compile_and_escape(partial_output)
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^I should see exactly "([^\"]*)"$/ do |exact_output|
|
38
|
+
combined_output.should == unescape(exact_output)
|
39
|
+
end
|
40
|
+
|
41
|
+
Then /^I should see exactly:$/ do |exact_output|
|
42
|
+
combined_output.should == exact_output
|
43
|
+
end
|
44
|
+
|
45
|
+
Then /^the exit status should be (\d+)$/ do |exit_status|
|
46
|
+
@last_exit_status.should == exit_status.to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
Then /^the exit status should not be (\d+)$/ do |exit_status|
|
50
|
+
@last_exit_status.should_not == exit_status.to_i
|
51
|
+
end
|
52
|
+
|
53
|
+
Then /^it should (pass|fail) with:$/ do |pass_fail, partial_output|
|
54
|
+
if pass_fail == 'pass'
|
55
|
+
@last_exit_status.should == 0
|
56
|
+
else
|
57
|
+
@last_exit_status.should_not == 0
|
58
|
+
end
|
59
|
+
Then "I should see:", partial_output
|
60
|
+
end
|
61
|
+
|
62
|
+
Then /^the stderr should contain "([^\"]*)"$/ do |partial_output|
|
63
|
+
@last_stderr.should =~ compile_and_escape(partial_output)
|
64
|
+
end
|
65
|
+
|
66
|
+
Then /^the stdout should contain "([^\"]*)"$/ do |partial_output|
|
67
|
+
@last_stdout.should =~ compile_and_escape(partial_output)
|
68
|
+
end
|
69
|
+
|
70
|
+
Then /^the stderr should not contain "([^\"]*)"$/ do |partial_output|
|
71
|
+
@last_stderr.should_not =~ compile_and_escape(partial_output)
|
72
|
+
end
|
73
|
+
|
74
|
+
Then /^the stdout should not contain "([^\"]*)"$/ do |partial_output|
|
75
|
+
@last_stdout.should_not =~ compile_and_escape(partial_output)
|
76
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aruba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- "Aslak Helles\xC3\xB8y"
|
@@ -10,29 +15,37 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2010-02-
|
18
|
+
date: 2010-02-23 00:00:00 +01:00
|
14
19
|
default_executable:
|
15
20
|
dependencies:
|
16
21
|
- !ruby/object:Gem::Dependency
|
17
22
|
name: rspec
|
18
|
-
|
19
|
-
|
20
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
21
25
|
requirements:
|
22
26
|
- - ">="
|
23
27
|
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 3
|
31
|
+
- 0
|
24
32
|
version: 1.3.0
|
25
|
-
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
26
35
|
- !ruby/object:Gem::Dependency
|
27
36
|
name: cucumber
|
28
|
-
|
29
|
-
|
30
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
39
|
requirements:
|
32
40
|
- - ">="
|
33
41
|
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 6
|
45
|
+
- 2
|
34
46
|
version: 0.6.2
|
35
|
-
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
36
49
|
description: CLI Steps for Cucumber, hand-crafted for you in Aruba
|
37
50
|
email: cukes@groups.google.com
|
38
51
|
executables: []
|
@@ -45,6 +58,7 @@ extra_rdoc_files:
|
|
45
58
|
files:
|
46
59
|
- .document
|
47
60
|
- .gitignore
|
61
|
+
- History.txt
|
48
62
|
- LICENSE
|
49
63
|
- README.rdoc
|
50
64
|
- Rakefile
|
@@ -55,6 +69,8 @@ files:
|
|
55
69
|
- features/step_definitions/aruba_steps.rb
|
56
70
|
- features/support/env.rb
|
57
71
|
- lib/aruba.rb
|
72
|
+
- lib/aruba/api.rb
|
73
|
+
- lib/aruba/cucumber.rb
|
58
74
|
has_rdoc: true
|
59
75
|
homepage: http://github.com/aslakhellesoy/aruba
|
60
76
|
licenses: []
|
@@ -68,18 +84,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
84
|
requirements:
|
69
85
|
- - ">="
|
70
86
|
- !ruby/object:Gem::Version
|
87
|
+
segments:
|
88
|
+
- 0
|
71
89
|
version: "0"
|
72
|
-
version:
|
73
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
91
|
requirements:
|
75
92
|
- - ">="
|
76
93
|
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 0
|
77
96
|
version: "0"
|
78
|
-
version:
|
79
97
|
requirements: []
|
80
98
|
|
81
99
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.3.
|
100
|
+
rubygems_version: 1.3.6
|
83
101
|
signing_key:
|
84
102
|
specification_version: 3
|
85
103
|
summary: CLI Steps for Cucumber
|