aruba 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +5 -0
- data/History.txt +9 -0
- data/README.rdoc +0 -22
- data/Rakefile +7 -42
- data/aruba.gemspec +17 -53
- data/lib/aruba/api.rb +165 -138
- data/lib/aruba/cucumber.rb +38 -17
- metadata +20 -31
- data/features/running_ruby.feature +0 -76
data/.bundle/config
ADDED
data/.gitignore
CHANGED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm @cucumber
|
data/Gemfile
ADDED
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.2.2
|
2
|
+
|
3
|
+
=== New Features
|
4
|
+
* Added a @bin tag that sets up './bin' first on the path (Aslak Hellesøy)
|
5
|
+
* Richer API making aruba easier to use from Ruby code. (Mark Nijhof, Aslak Hellesøy)
|
6
|
+
|
7
|
+
=== Removed Features
|
8
|
+
* No more support for RVM. Use rvm 1.9.2,1.8.7 exec cucumber .... instead. (Mark Nijhof, Aslak Hellesøy)
|
9
|
+
|
1
10
|
== 0.2.1
|
2
11
|
|
3
12
|
=== Bugfixes
|
data/README.rdoc
CHANGED
@@ -16,28 +16,6 @@ You now have a bunch of step definitions that you can use in your features. Look
|
|
16
16
|
to see all the step definitions. Look at features/*.feature for examples (which are also testing Aruba
|
17
17
|
itself).
|
18
18
|
|
19
|
-
== Ruby/RVM love
|
20
|
-
|
21
|
-
Aruba has a couple of step definitions that make it easier to test your ruby command line program
|
22
|
-
with specific versions of Ruby (regardless of what Ruby version you're using to invoke Cucumber).
|
23
|
-
|
24
|
-
This is done with the follwoing step definitions:
|
25
|
-
|
26
|
-
/^I am using rvm "([^"]*)"$/
|
27
|
-
/^I am using rvm gemset "([^"]*)"$/
|
28
|
-
|
29
|
-
Then, if you use the step definition:
|
30
|
-
|
31
|
-
/^I run "(.*)"$/
|
32
|
-
|
33
|
-
.. with a command that starts with <tt>ruby</tt>, Aruba will actually invoke the Ruby version (and gemset
|
34
|
-
if you specified) instead of just <tt>ruby</tt>, which would be the one on your <tt>PATH</tt>, which might
|
35
|
-
not be the one you want. The same goes for commands starting with <tt>bundle</tt>,
|
36
|
-
<tt>cucumber</tt>, <tt>gem</tt>, <tt>jeweler</tt>, <tt>rails</tt>, <tt>rake</tt>, <tt>rspec</tt> and <tt>spec</tt> -
|
37
|
-
they can all be run with a particular ruby version that you specify.
|
38
|
-
|
39
|
-
See features/running_ruby.feature for examples.
|
40
|
-
|
41
19
|
== Getting more output with tags.
|
42
20
|
|
43
21
|
Aruba has several tags you can use to see what command actually gets run (useful if you're using the RVM steps),
|
data/Rakefile
CHANGED
@@ -1,48 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
2
|
require 'rubygems'
|
3
|
-
require '
|
3
|
+
require 'bundler'
|
4
|
+
Bundler.setup
|
5
|
+
Bundler::GemHelper.install_tasks
|
4
6
|
|
5
|
-
|
6
|
-
require 'jeweler'
|
7
|
-
Jeweler::Tasks.new do |gem|
|
8
|
-
gem.version = "0.2.1"
|
9
|
-
gem.name = "aruba"
|
10
|
-
gem.summary = %Q{CLI Steps for Cucumber}
|
11
|
-
gem.description = %Q{CLI Steps for Cucumber, hand-crafted for you in Aruba}
|
12
|
-
gem.email = "cukes@googlegroups.com"
|
13
|
-
gem.homepage = "http://github.com/aslakhellesoy/aruba"
|
14
|
-
gem.authors = ["Aslak Hellesøy", "David Chelimsky"]
|
15
|
-
gem.add_development_dependency "rspec", ">= 2.0.0.beta.17"
|
16
|
-
gem.add_development_dependency "cucumber", ">= 0.8.4"
|
17
|
-
end
|
18
|
-
Jeweler::GemcutterTasks.new
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
require 'cucumber/rake/task'
|
25
|
-
|
26
|
-
Cucumber::Rake::Task.new do |t|
|
27
|
-
t.cucumber_opts = %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
|
28
|
-
t.rcov = true
|
29
|
-
end
|
7
|
+
require 'cucumber/rake/task'
|
30
8
|
|
31
|
-
|
32
|
-
|
33
|
-
task :cucumber do
|
34
|
-
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
35
|
-
end
|
9
|
+
Cucumber::Rake::Task.new do |t|
|
10
|
+
t.cucumber_opts = %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
|
36
11
|
end
|
37
12
|
|
38
13
|
task :default => :cucumber
|
39
|
-
|
40
|
-
require 'rake/rdoctask'
|
41
|
-
Rake::RDocTask.new do |rdoc|
|
42
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
43
|
-
|
44
|
-
rdoc.rdoc_dir = 'rdoc'
|
45
|
-
rdoc.title = "aruba #{version}"
|
46
|
-
rdoc.rdoc_files.include('README*')
|
47
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
|
-
end
|
data/aruba.gemspec
CHANGED
@@ -1,60 +1,24 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
5
|
+
s.name = 'aruba'
|
6
|
+
s.version = "0.2.2"
|
7
|
+
s.authors = ["Aslak Hellesøy", "David Chelimsky"]
|
8
|
+
s.description = 'CLI Steps for Cucumber, hand-crafted for you in Aruba'
|
9
|
+
s.summary = "aruba-#{s.version}"
|
10
|
+
s.email = 'cukes@googlegroups.com'
|
11
|
+
s.homepage = 'http://github.com/aslakhellesoy/aruba'
|
9
12
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.date = %q{2010-07-14}
|
13
|
-
s.description = %q{CLI Steps for Cucumber, hand-crafted for you in Aruba}
|
14
|
-
s.email = %q{cukes@googlegroups.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"History.txt",
|
23
|
-
"LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"aruba.gemspec",
|
27
|
-
"config/.gitignore",
|
28
|
-
"features/exit_statuses.feature",
|
29
|
-
"features/file_system_commands.feature",
|
30
|
-
"features/output.feature",
|
31
|
-
"features/running_ruby.feature",
|
32
|
-
"features/step_definitions/aruba_dev_steps.rb",
|
33
|
-
"features/support/env.rb",
|
34
|
-
"lib/aruba.rb",
|
35
|
-
"lib/aruba/api.rb",
|
36
|
-
"lib/aruba/cucumber.rb"
|
37
|
-
]
|
38
|
-
s.homepage = %q{http://github.com/aslakhellesoy/aruba}
|
39
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
40
|
-
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.3.7}
|
42
|
-
s.summary = %q{CLI Steps for Cucumber}
|
13
|
+
s.add_dependency 'cucumber', '~> 0.9.0' unless File.directory?(File.dirname(__FILE__) + '/../cucumber')
|
14
|
+
s.add_development_dependency('rspec', "~> 2.0.0.beta.22")
|
43
15
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.17"])
|
53
|
-
s.add_dependency(%q<cucumber>, [">= 0.8.4"])
|
54
|
-
end
|
55
|
-
else
|
56
|
-
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.17"])
|
57
|
-
s.add_dependency(%q<cucumber>, [">= 0.8.4"])
|
58
|
-
end
|
16
|
+
s.rubygems_version = "1.3.7"
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.extra_rdoc_files = ["LICENSE", "README.rdoc", "History.txt"]
|
21
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
22
|
+
s.require_path = "lib"
|
59
23
|
end
|
60
24
|
|
data/lib/aruba/api.rb
CHANGED
@@ -2,192 +2,219 @@ require 'tempfile'
|
|
2
2
|
require 'rbconfig'
|
3
3
|
|
4
4
|
module Aruba
|
5
|
-
module Api
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
module Api
|
6
|
+
def in_current_dir(&block)
|
7
|
+
_mkdir(current_dir)
|
8
|
+
Dir.chdir(current_dir, &block)
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def current_dir
|
12
|
+
File.join(*dirs)
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def cd(dir)
|
16
|
+
dirs << dir
|
17
|
+
raise "#{current_dir} is not a directory." unless File.directory?(current_dir)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def dirs
|
21
|
+
@dirs ||= ['tmp/aruba']
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def create_file(file_name, file_content, check_presence = false)
|
25
|
+
in_current_dir do
|
26
|
+
raise "expected #{file_name} to be present" if check_presence && !File.file?(file_name)
|
27
|
+
_mkdir(File.dirname(file_name))
|
28
|
+
File.open(file_name, 'w') { |f| f << file_content }
|
29
|
+
end
|
28
30
|
end
|
29
|
-
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
def append_to_file(file_name, file_content)
|
33
|
+
in_current_dir do
|
34
|
+
File.open(file_name, 'a') { |f| f << file_content }
|
35
|
+
end
|
34
36
|
end
|
35
|
-
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def create_dir(dir_name)
|
39
|
+
in_current_dir do
|
40
|
+
_mkdir(dir_name)
|
41
|
+
end
|
40
42
|
end
|
41
|
-
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
def check_file_presence(paths, expect_presence)
|
45
|
+
in_current_dir do
|
46
|
+
paths.each do |path|
|
47
|
+
if expect_presence
|
48
|
+
File.should be_file(path)
|
49
|
+
else
|
50
|
+
File.should_not be_file(path)
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
53
|
-
end
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
56
|
+
def check_file_content(file, partial_content, expect_match)
|
57
|
+
regexp = compile_and_escape(partial_content)
|
58
|
+
in_current_dir do
|
59
|
+
content = IO.read(file)
|
60
|
+
if expect_match
|
61
|
+
content.should =~ regexp
|
62
|
+
else
|
63
|
+
content.should_not =~ regexp
|
64
|
+
end
|
63
65
|
end
|
64
66
|
end
|
65
|
-
end
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
def check_exact_file_content(file, exact_content)
|
69
|
+
in_current_dir do
|
70
|
+
IO.read(file).should == exact_content
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def check_directory_presence(paths, expect_presence)
|
75
|
+
in_current_dir do
|
76
|
+
paths.each do |path|
|
77
|
+
if expect_presence
|
78
|
+
File.should be_directory(path)
|
79
|
+
else
|
80
|
+
File.should_not be_directory(path)
|
81
|
+
end
|
74
82
|
end
|
75
83
|
end
|
76
84
|
end
|
77
|
-
end
|
78
85
|
|
79
|
-
|
80
|
-
|
81
|
-
|
86
|
+
def _mkdir(dir_name)
|
87
|
+
FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
|
88
|
+
end
|
82
89
|
|
83
|
-
|
84
|
-
|
85
|
-
|
90
|
+
def unescape(string)
|
91
|
+
eval(%{"#{string}"})
|
92
|
+
end
|
86
93
|
|
87
|
-
|
88
|
-
|
89
|
-
|
94
|
+
def compile_and_escape(string)
|
95
|
+
Regexp.compile(Regexp.escape(string))
|
96
|
+
end
|
90
97
|
|
91
|
-
|
92
|
-
|
93
|
-
|
98
|
+
def combined_output
|
99
|
+
@last_stdout + (@last_stderr == '' ? '' : "\n#{'-'*70}\n#{@last_stderr}")
|
100
|
+
end
|
94
101
|
|
95
|
-
|
96
|
-
|
97
|
-
@rvm_ruby_version = YAML.load_file('config/aruba-rvm.yml')[rvm_ruby_version] || rvm_ruby_version
|
98
|
-
else
|
99
|
-
@rvm_ruby_version = rvm_ruby_version
|
102
|
+
def assert_partial_output(partial_output)
|
103
|
+
combined_output.should =~ compile_and_escape(partial_output)
|
100
104
|
end
|
101
|
-
end
|
102
105
|
|
103
|
-
|
104
|
-
|
105
|
-
if empty_gemset && ENV['GOTGEMS'].nil?
|
106
|
-
delete_rvm_gemset(rvm_gemset)
|
107
|
-
create_rvm_gemset(rvm_gemset)
|
106
|
+
def assert_passing_with(partial_output)
|
107
|
+
assert_exit_status_and_partial_output(true, partial_output)
|
108
108
|
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def delete_rvm_gemset(rvm_gemset)
|
112
|
-
raise "You haven't specified what ruby version rvm should use." if @rvm_ruby_version.nil?
|
113
|
-
run "rvm --force gemset delete #{@rvm_ruby_version}@#{rvm_gemset}"
|
114
|
-
end
|
115
|
-
|
116
|
-
def create_rvm_gemset(rvm_gemset)
|
117
|
-
raise "You haven't specified what ruby version rvm should use." if @rvm_ruby_version.nil?
|
118
|
-
run "rvm --create #{@rvm_ruby_version}@#{rvm_gemset}"
|
119
|
-
end
|
120
109
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
110
|
+
def assert_failing_with(partial_output)
|
111
|
+
assert_exit_status_and_partial_output(false, partial_output)
|
112
|
+
end
|
113
|
+
|
114
|
+
def assert_exit_status_and_partial_output(expect_to_pass, partial_output)
|
115
|
+
assert_partial_output(partial_output)
|
116
|
+
if expect_to_pass
|
117
|
+
@last_exit_status.should == 0
|
118
|
+
else
|
119
|
+
@last_exit_status.should_not == 0
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def install_gems(gemfile)
|
124
|
+
create_file("Gemfile", gemfile)
|
125
|
+
if ENV['GOTGEMS'].nil?
|
126
|
+
run("gem install bundler")
|
127
|
+
run("bundle --no-color install")
|
128
|
+
end
|
126
129
|
end
|
127
|
-
end
|
128
130
|
|
129
|
-
|
130
|
-
|
131
|
-
cmd = detect_ruby(cmd)
|
131
|
+
def run(cmd, fail_on_error=true)
|
132
|
+
cmd = detect_ruby(cmd)
|
132
133
|
|
133
|
-
|
134
|
+
stderr_file = Tempfile.new('cucumber')
|
135
|
+
stderr_file.close
|
136
|
+
in_current_dir do
|
137
|
+
announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
|
138
|
+
announce_or_puts("$ #{cmd}") if @announce_cmd
|
134
139
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
140
|
+
mode = RUBY_VERSION =~ /^1\.9/ ? {:external_encoding=>"UTF-8"} : 'r'
|
141
|
+
|
142
|
+
IO.popen("#{cmd} 2> #{stderr_file.path}", mode) do |io|
|
143
|
+
@last_stdout = io.read
|
144
|
+
announce_or_puts(@last_stdout) if @announce_stdout
|
145
|
+
end
|
141
146
|
|
142
|
-
|
147
|
+
@last_exit_status = $?.exitstatus
|
143
148
|
end
|
149
|
+
@last_stderr = IO.read(stderr_file.path)
|
144
150
|
|
145
|
-
@
|
146
|
-
end
|
147
|
-
@last_stderr = IO.read(stderr_file.path)
|
151
|
+
announce_or_puts(@last_stderr) if @announce_stderr
|
148
152
|
|
149
|
-
|
153
|
+
if(@last_exit_status != 0 && fail_on_error)
|
154
|
+
fail("Exit status was #{@last_exit_status}. Output:\n#{combined_output}")
|
155
|
+
end
|
150
156
|
|
151
|
-
|
152
|
-
fail("Exit status was #{@last_exit_status}. Output:\n#{combined_output}")
|
157
|
+
@last_stderr
|
153
158
|
end
|
154
159
|
|
155
|
-
|
156
|
-
|
160
|
+
def announce_or_puts(msg)
|
161
|
+
if(@puts)
|
162
|
+
puts(msg)
|
163
|
+
else
|
164
|
+
announce(msg)
|
165
|
+
end
|
166
|
+
end
|
157
167
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
168
|
+
def detect_ruby(cmd)
|
169
|
+
if cmd =~ /^ruby\s/
|
170
|
+
cmd.gsub(/^ruby\s/, "#{current_ruby} ")
|
171
|
+
else
|
172
|
+
cmd
|
173
|
+
end
|
163
174
|
end
|
164
|
-
end
|
165
175
|
|
166
|
-
|
167
|
-
|
168
|
-
cmd.gsub(/^ruby\s/, "#{current_ruby} ")
|
169
|
-
else
|
170
|
-
cmd
|
176
|
+
def current_ruby
|
177
|
+
File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
171
178
|
end
|
172
|
-
end
|
173
179
|
|
174
|
-
|
180
|
+
def use_clean_gemset(gemset)
|
181
|
+
run(%{rvm gemset create "#{gemset}"}, true)
|
182
|
+
if @last_stdout =~ /'#{gemset}' gemset created \((.*)\)\./
|
183
|
+
gem_home = $1
|
184
|
+
set_env('GEM_HOME', gem_home)
|
185
|
+
set_env('GEM_PATH', gem_home)
|
186
|
+
set_env('BUNDLE_PATH', gem_home)
|
187
|
+
|
188
|
+
paths = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
|
189
|
+
paths.unshift(File.join(gem_home, 'bin'))
|
190
|
+
set_env('PATH', paths.uniq.join(File::PATH_SEPARATOR))
|
175
191
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
cmd
|
192
|
+
run("gem install bundler", true)
|
193
|
+
else
|
194
|
+
raise "I didn't understand rvm's output: #{@last_stdout}"
|
195
|
+
end
|
181
196
|
end
|
182
|
-
end
|
183
197
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
198
|
+
def unset_bundler_env_vars
|
199
|
+
%w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key|
|
200
|
+
set_env(key, nil)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def set_env(key, value)
|
205
|
+
announce_or_puts(%{$ export #{key}="#{value}"}) if @announce_env
|
206
|
+
original_env[key] = ENV.delete(key)
|
207
|
+
ENV[key] = value
|
208
|
+
end
|
209
|
+
|
210
|
+
def restore_env
|
211
|
+
original_env.each do |key, value|
|
212
|
+
ENV[key] = value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def original_env
|
217
|
+
@original_env ||= {}
|
190
218
|
end
|
191
219
|
end
|
192
220
|
end
|
193
|
-
end
|
data/lib/aruba/cucumber.rb
CHANGED
@@ -2,6 +2,19 @@ require 'aruba/api'
|
|
2
2
|
|
3
3
|
World(Aruba::Api)
|
4
4
|
|
5
|
+
Before('@disable-bundler') do
|
6
|
+
unset_bundler_env_vars
|
7
|
+
end
|
8
|
+
|
9
|
+
Before('@bin') do
|
10
|
+
@__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
|
11
|
+
ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR)
|
12
|
+
end
|
13
|
+
|
14
|
+
After('@bin') do
|
15
|
+
ENV['PATH'] = @__aruba_original_paths.join(File::PATH_SEPARATOR)
|
16
|
+
end
|
17
|
+
|
5
18
|
Before do
|
6
19
|
FileUtils.rm_rf(current_dir)
|
7
20
|
end
|
@@ -22,23 +35,28 @@ Before('@announce-stderr') do
|
|
22
35
|
@announce_stderr = true
|
23
36
|
end
|
24
37
|
|
38
|
+
Before('@announce-dir') do
|
39
|
+
@announce_dir = true
|
40
|
+
end
|
41
|
+
|
42
|
+
Before('@announce-env') do
|
43
|
+
@announce_env = true
|
44
|
+
end
|
45
|
+
|
25
46
|
Before('@announce') do
|
26
47
|
@announce_stdout = true
|
27
48
|
@announce_stderr = true
|
28
49
|
@announce_cmd = true
|
50
|
+
@announce_dir = true
|
51
|
+
@announce_env = true
|
29
52
|
end
|
30
53
|
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
Given /^I am using( an empty)? rvm gemset "([^"]*)"$/ do |empty_gemset, rvm_gemset|
|
36
|
-
use_rvm_gemset(rvm_gemset, empty_gemset)
|
54
|
+
After do
|
55
|
+
restore_env
|
37
56
|
end
|
38
57
|
|
39
|
-
Given /^I
|
40
|
-
|
41
|
-
install_gems(gemfile)
|
58
|
+
Given /^I'm using a clean gemset "([^"]*)"$/ do |gemset|
|
59
|
+
use_clean_gemset(gemset)
|
42
60
|
end
|
43
61
|
|
44
62
|
Given /^a directory named "([^"]*)"$/ do |dir_name|
|
@@ -54,7 +72,11 @@ Given /^an empty file named "([^"]*)"$/ do |file_name|
|
|
54
72
|
end
|
55
73
|
|
56
74
|
When /^I write to "([^"]*)" with:$/ do |file_name, file_content|
|
57
|
-
create_file(file_name, file_content)
|
75
|
+
create_file(file_name, file_content, false)
|
76
|
+
end
|
77
|
+
|
78
|
+
When /^I overwrite "([^"]*)" with:$/ do |file_name, file_content|
|
79
|
+
create_file(file_name, file_content, true)
|
58
80
|
end
|
59
81
|
|
60
82
|
When /^I append to "([^"]*)" with:$/ do |file_name, file_content|
|
@@ -74,7 +96,7 @@ When /^I successfully run "(.*)"$/ do |cmd|
|
|
74
96
|
end
|
75
97
|
|
76
98
|
Then /^the output should contain "([^"]*)"$/ do |partial_output|
|
77
|
-
|
99
|
+
assert_partial_output(partial_output)
|
78
100
|
end
|
79
101
|
|
80
102
|
Then /^the output should not contain "([^"]*)"$/ do |partial_output|
|
@@ -118,12 +140,7 @@ Then /^the exit status should not be (\d+)$/ do |exit_status|
|
|
118
140
|
end
|
119
141
|
|
120
142
|
Then /^it should (pass|fail) with:$/ do |pass_fail, partial_output|
|
121
|
-
|
122
|
-
if pass_fail == 'pass'
|
123
|
-
@last_exit_status.should == 0
|
124
|
-
else
|
125
|
-
@last_exit_status.should_not == 0
|
126
|
-
end
|
143
|
+
self.__send__("assert_#{pass_fail}ing_with", partial_output)
|
127
144
|
end
|
128
145
|
|
129
146
|
Then /^the stderr should contain "([^"]*)"$/ do |partial_output|
|
@@ -165,3 +182,7 @@ end
|
|
165
182
|
Then /^the file "([^"]*)" should not contain "([^"]*)"$/ do |file, partial_content|
|
166
183
|
check_file_content(file, partial_content, false)
|
167
184
|
end
|
185
|
+
|
186
|
+
Then /^the file "([^"]*)" should contain exactly:$/ do |file, exact_content|
|
187
|
+
check_exact_file_content(file, exact_content)
|
188
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aruba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 21
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- "Aslak Helles\xC3\xB8y"
|
@@ -16,43 +15,26 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-
|
18
|
+
date: 2010-09-28 00:00:00 +02:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: rspec
|
24
|
-
prerelease: false
|
25
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
24
|
none: false
|
27
25
|
requirements:
|
28
|
-
- -
|
26
|
+
- - ~>
|
29
27
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 62196417
|
31
28
|
segments:
|
32
29
|
- 2
|
33
30
|
- 0
|
34
31
|
- 0
|
35
32
|
- beta
|
36
|
-
-
|
37
|
-
version: 2.0.0.beta.
|
33
|
+
- 22
|
34
|
+
version: 2.0.0.beta.22
|
38
35
|
type: :development
|
39
|
-
version_requirements: *id001
|
40
|
-
- !ruby/object:Gem::Dependency
|
41
|
-
name: cucumber
|
42
36
|
prerelease: false
|
43
|
-
|
44
|
-
none: false
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
hash: 55
|
49
|
-
segments:
|
50
|
-
- 0
|
51
|
-
- 8
|
52
|
-
- 4
|
53
|
-
version: 0.8.4
|
54
|
-
type: :development
|
55
|
-
version_requirements: *id002
|
37
|
+
version_requirements: *id001
|
56
38
|
description: CLI Steps for Cucumber, hand-crafted for you in Aruba
|
57
39
|
email: cukes@googlegroups.com
|
58
40
|
executables: []
|
@@ -62,9 +44,13 @@ extensions: []
|
|
62
44
|
extra_rdoc_files:
|
63
45
|
- LICENSE
|
64
46
|
- README.rdoc
|
47
|
+
- History.txt
|
65
48
|
files:
|
49
|
+
- .bundle/config
|
66
50
|
- .document
|
67
51
|
- .gitignore
|
52
|
+
- .rvmrc
|
53
|
+
- Gemfile
|
68
54
|
- History.txt
|
69
55
|
- LICENSE
|
70
56
|
- README.rdoc
|
@@ -74,7 +60,6 @@ files:
|
|
74
60
|
- features/exit_statuses.feature
|
75
61
|
- features/file_system_commands.feature
|
76
62
|
- features/output.feature
|
77
|
-
- features/running_ruby.feature
|
78
63
|
- features/step_definitions/aruba_dev_steps.rb
|
79
64
|
- features/support/env.rb
|
80
65
|
- lib/aruba.rb
|
@@ -94,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
79
|
requirements:
|
95
80
|
- - ">="
|
96
81
|
- !ruby/object:Gem::Version
|
97
|
-
hash:
|
82
|
+
hash: -4569990399703836797
|
98
83
|
segments:
|
99
84
|
- 0
|
100
85
|
version: "0"
|
@@ -103,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
88
|
requirements:
|
104
89
|
- - ">="
|
105
90
|
- !ruby/object:Gem::Version
|
106
|
-
hash:
|
91
|
+
hash: -4569990399703836797
|
107
92
|
segments:
|
108
93
|
- 0
|
109
94
|
version: "0"
|
@@ -113,6 +98,10 @@ rubyforge_project:
|
|
113
98
|
rubygems_version: 1.3.7
|
114
99
|
signing_key:
|
115
100
|
specification_version: 3
|
116
|
-
summary:
|
117
|
-
test_files:
|
118
|
-
|
101
|
+
summary: aruba-0.2.2
|
102
|
+
test_files:
|
103
|
+
- features/exit_statuses.feature
|
104
|
+
- features/file_system_commands.feature
|
105
|
+
- features/output.feature
|
106
|
+
- features/step_definitions/aruba_dev_steps.rb
|
107
|
+
- features/support/env.rb
|
@@ -1,76 +0,0 @@
|
|
1
|
-
@announce
|
2
|
-
Feature: Running ruby
|
3
|
-
In order to test a Ruby-based CLI app
|
4
|
-
I want to have control over what Ruby version is used,
|
5
|
-
possibly using a different Ruby than the one I launch Cucumber with.
|
6
|
-
|
7
|
-
Scenario: Run with ruby 1.9.1
|
8
|
-
Given I am using rvm "1.9.1"
|
9
|
-
When I run "ruby -e 'puts RUBY_VERSION'"
|
10
|
-
Then the output should contain "ruby-1.9.1-p378"
|
11
|
-
And the output should not contain "rvm usage"
|
12
|
-
|
13
|
-
Scenario: Run with ruby JRuby
|
14
|
-
Given I am using rvm "jruby"
|
15
|
-
When I run "ruby -e 'puts JRUBY_VERSION'"
|
16
|
-
Then the output should contain "1.5.1"
|
17
|
-
And the output should not contain "rvm usage"
|
18
|
-
|
19
|
-
Scenario: Install gems with bundler
|
20
|
-
Given I am using rvm "1.9.1"
|
21
|
-
And I am using rvm gemset "a-new-gemset-where-no-gems-are-installed" with Gemfile:
|
22
|
-
"""
|
23
|
-
source :gemcutter
|
24
|
-
gem 'diff-lcs', '1.1.2'
|
25
|
-
"""
|
26
|
-
When I run "gem list"
|
27
|
-
Then the output should match:
|
28
|
-
"""
|
29
|
-
bundler \(\d+\.+\d+\.+\d+\)
|
30
|
-
diff-lcs \(\d+\.+\d+\.+\d+\)
|
31
|
-
"""
|
32
|
-
|
33
|
-
Scenario: Find the version of ruby 1.9.1
|
34
|
-
Given I am using rvm "1.9.1"
|
35
|
-
When I run "ruby --version"
|
36
|
-
Then the output should contain "1.9.1"
|
37
|
-
|
38
|
-
Scenario: Find the version of cucumber on ruby 1.9.1
|
39
|
-
Given I am using rvm "1.9.1"
|
40
|
-
When I run "cucumber --version"
|
41
|
-
Then the output should match /\d+\.+\d+\.+\d+/
|
42
|
-
|
43
|
-
Scenario: Use current ruby
|
44
|
-
When I run "ruby --version"
|
45
|
-
Then the output should contain the current Ruby version
|
46
|
-
|
47
|
-
Scenario: Use current ruby and a gem bin file
|
48
|
-
When I run "rake --version"
|
49
|
-
Then the output should contain "rake, version"
|
50
|
-
|
51
|
-
# I have trouble running rvm 1.8.7 in OS X Leopard, which is
|
52
|
-
# ruby-1.8.7-p249 (It segfaults rather often). However, a previous
|
53
|
-
# patchlevel of 1.8.7 runs fine for me: ruby-1.8.7-tv1_8_7_174
|
54
|
-
#
|
55
|
-
# In order to provide some level of flexibility (and readability)
|
56
|
-
# it should be possible to set up a mapping from a version specified
|
57
|
-
# in Gherkin to an *actual* version.
|
58
|
-
#
|
59
|
-
# In order to make this scenario pass you therefore need to install
|
60
|
-
# ruby-1.8.7-tv1_8_7_174 with rvm.
|
61
|
-
Scenario: Specify an alias for an rvm
|
62
|
-
Given I have a local file named "config/aruba-rvm.yml" with:
|
63
|
-
"""
|
64
|
-
1.8.7: ruby-1.8.7-tv1_8_7_174
|
65
|
-
"""
|
66
|
-
And I am using rvm "1.8.7"
|
67
|
-
When I run "ruby --version"
|
68
|
-
Then the output should contain "patchlevel 174"
|
69
|
-
|
70
|
-
# To verify this, make sure current rvm is *not* JRuby and run:
|
71
|
-
#
|
72
|
-
# ~/.rvm/rubies/jruby-1.4.0/bin/jruby -S cucumber features/running_ruby.feature -n "launched Cucumber"
|
73
|
-
@jruby
|
74
|
-
Scenario: Don't use rvm, but default to same Ruby as the one that launched Cucumber
|
75
|
-
When I run "ruby -e 'puts JRUBY_VERSION if defined?(JRUBY_VERSION)'"
|
76
|
-
Then the output should contain the JRuby version
|