Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 8 commits
  • 7 files changed
  • 3 commit comments
  • 2 contributors
Showing with 62 additions and 22 deletions.
  1. +5 −0 History.txt
  2. +2 −2 Rakefile
  3. +1 −1 features/output.feature
  4. +16 −9 features/running_ruby.feature
  5. +1 −0 features/step_definitions/aruba_dev_steps.rb
  6. +28 −3 lib/aruba/api.rb
  7. +9 −7 lib/aruba/cucumber.rb
View
5 History.txt
@@ -1,3 +1,8 @@
+== 0.1.8
+* Use // instead of "" for "I should see matching" step. (Aslak Hellesøy)
+* Replace rvm gemset character '%' with '@' for rvm 0.1.24 (#5 Ashley Moran)
+* Support gem bundler, making it easier to specify gems. (Aslak Hellesøy)
+
== 0.1.7
* New @announce-stderr tag (Robert Wahler)
* New "I should see matching" steps using Regexp (Robert Wahler)
View
4 Rakefile
@@ -5,7 +5,7 @@ require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
- gem.version = "0.1.7"
+ gem.version = "0.1.8"
gem.name = "aruba"
gem.summary = %Q{CLI Steps for Cucumber}
gem.description = %Q{CLI Steps for Cucumber, hand-crafted for you in Aruba}
@@ -13,7 +13,7 @@ begin
gem.homepage = "http://github.com/aslakhellesoy/aruba"
gem.authors = ["Aslak Hellesøy", "David Chelimsky"]
gem.add_development_dependency "rspec", ">= 1.3.0"
- gem.add_development_dependency "cucumber", ">= 0.6.2"
+ gem.add_development_dependency "cucumber", ">= 0.7.0.beta.6"
end
Jeweler::GemcutterTasks.new
rescue LoadError
View
2 features/output.feature
@@ -47,7 +47,7 @@ Feature: Output
Scenario: Detect subset of one-line output with regex
When I run "ruby --version"
Then I should see "ruby"
- And I should see matching "ruby ([\d]+\.[\d]+\.[\d]+) \(.*$"
+ And I should see matching /ruby ([\d]+\.[\d]+\.[\d]+)(p\d+)? \(.*$/
@announce
Scenario: Detect subset of multiline output with regex
View
25 features/running_ruby.feature
@@ -16,18 +16,25 @@ Feature: Running ruby
Then I should see "1.4.0"
And I should not see "rvm usage"
- Scenario: Specify both rvm and gemset
+ Scenario: Install gems with bundler
Given I am using rvm "1.9.1"
- And I am using rvm gemset "a-gemset-where-nothing-is-installed-except-default-rvm-gems"
+ And I am using rvm gemset "a-new-gemset-where-no-gems-are-installed" with Gemfile:
+ """
+ gem 'diff-lcs', '1.1.2'
+ """
When I run "gem list"
- Then I should see:
+ Then I should see matching:
"""
-
- rake (0.8.7)
- rubygems-update (1.3.5)
-
+ bundler \(\d+\.+\d+\.+\d+\)
+ diff-lcs \(\d+\.+\d+\.+\d+\)
"""
+ Scenario: Specify both rvm and gemset
+ Given I am using rvm "1.9.1"
+ And I am using an empty rvm gemset "a-new-gemset-where-no-gems-are-installed"
+ When I run "gem list | wc -l"
+ Then I should see exactly " 2\n"
+
Scenario: Find the version of ruby 1.9.1
Given I am using rvm "1.9.1"
When I run "ruby --version"
@@ -36,7 +43,7 @@ Feature: Running ruby
Scenario: Find the version of cucumber on ruby 1.9.1
Given I am using rvm "1.9.1"
When I run "cucumber --version"
- Then I should see "0.6.2"
+ Then I should see matching /\d+\.+\d+\.+\d+/
Scenario: Use current ruby
When I run "ruby --version"
@@ -70,5 +77,5 @@ Feature: Running ruby
# ~/.rvm/rubies/jruby-1.4.0/bin/jruby -S cucumber features/running_ruby.feature -n "launched Cucumber"
@jruby
Scenario: Don't use rvm, but default to same Ruby as the one that launched Cucumber
- When I run "ruby -e 'puts JRUBY_VERSION'"
+ When I run "ruby -e 'puts JRUBY_VERSION if defined?(JRUBY_VERSION)'"
Then I should see the JRuby version
View
1 features/step_definitions/aruba_dev_steps.rb
@@ -11,6 +11,7 @@
end
Then /^I should see the JRuby version$/ do
+ pending "This must be manually run in JRuby" unless defined?(JRUBY_VERSION)
Then %{I should see "#{JRUBY_VERSION}"}
end
View
31 lib/aruba/api.rb
@@ -88,11 +88,31 @@ def use_rvm(rvm_ruby_version)
end
end
- def use_rvm_gemset(rvm_gemset)
+ def use_rvm_gemset(rvm_gemset, empty_gemset)
@rvm_gemset = rvm_gemset
+ if empty_gemset
+ delete_rvm_gemset(rvm_gemset)
+ create_rvm_gemset(rvm_gemset)
+ end
+ end
+
+ def delete_rvm_gemset(rvm_gemset)
+ raise "You haven't specified what ruby version rvm should use." if @rvm_ruby_version.nil?
+ run "rvm --force gemset delete #{@rvm_ruby_version}@#{rvm_gemset}"
+ end
+
+ def create_rvm_gemset(rvm_gemset)
+ raise "You haven't specified what ruby version rvm should use." if @rvm_ruby_version.nil?
+ run "rvm --create #{@rvm_ruby_version}@#{rvm_gemset}"
+ end
+
+ def install_gems(gemfile)
+ create_file("Gemfile", gemfile)
+ run("gem install bundler")
+ run("bundle install")
end
- def run(cmd)
+ def run(cmd, fail_on_error=true)
cmd = detect_ruby_script(cmd)
cmd = detect_ruby(cmd)
@@ -113,6 +133,11 @@ def run(cmd)
@last_stderr = IO.read(stderr_file.path)
announce(@last_stderr) if @announce_stderr
+
+ if(@last_exit_status != 0 && fail_on_error)
+ fail("Exit status was #{@last_exit_status}. Output:\n#{combined_output}")
+ end
+
@last_stderr
end
@@ -136,7 +161,7 @@ def detect_ruby_script(cmd)
def current_ruby
if @rvm_ruby_version
- rvm_ruby_version_with_gemset = @rvm_gemset ? "#{@rvm_ruby_version}%#{@rvm_gemset}" : @rvm_ruby_version
+ rvm_ruby_version_with_gemset = @rvm_gemset ? "#{@rvm_ruby_version}@#{@rvm_gemset}" : @rvm_ruby_version
"rvm #{rvm_ruby_version_with_gemset} ruby"
else
File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
View
16 lib/aruba/cucumber.rb
@@ -28,8 +28,13 @@
use_rvm(rvm_ruby_version)
end
-Given /^I am using rvm gemset "([^\"]*)"$/ do |rvm_gemset|
- use_rvm_gemset(rvm_gemset)
+Given /^I am using( an empty)? rvm gemset "([^\"]*)"$/ do |empty_gemset, rvm_gemset|
+ use_rvm_gemset(rvm_gemset, empty_gemset)
+end
+
+Given /^I am using rvm gemset "([^\"]*)" with Gemfile:$/ do |rvm_gemset, gemfile|
+ use_rvm_gemset(rvm_gemset, true)
+ install_gems(gemfile)
end
Given /^a directory named "([^\"]*)"$/ do |dir_name|
@@ -53,14 +58,11 @@
end
When /^I run "(.*)"$/ do |cmd|
- run(unescape(cmd))
+ run(unescape(cmd), false)
end
When /^I successfully run "(.*)"$/ do |cmd|
run(unescape(cmd))
- if(@last_exit_status != 0)
- fail("Exit status was #{@last_exit_status}. Output:\n#{combined_output}")
- end
end
Then /^I should see "([^\"]*)"$/ do |partial_output|
@@ -91,7 +93,7 @@
# you don't need regex, use "I should see" instead since
# that way, you don't have to escape regex characters that
# appear naturally in the output
-Then /^I should see matching "([^\"]*)"$/ do |partial_output|
+Then /^I should see matching \/([^\/]*)\/$/ do |partial_output|
combined_output.should =~ /#{partial_output}/
end

Showing you all comments on commits in this comparison.

@fakeleft

Hi Aslak,

I'm very new to Aruba (and cucumber, for that matter), and I'm trying to piece together how to use it from whatever I can dig up online. I assumed that if an executable didn't exist, i would get a failure when running a scenario that started with:

When I run "test_exe"

Instead it passes, and it looks like it's due to this commit. Is there a reason why we'd want things to pass in this situation?

As an aside, can you point me to a descent aruba tutorial? This seems to be the best I've found thus far.

Thanks.

@aslakhellesoy
Cucumber member

Please stick this in an isdue so it stays on the radar.

Aslak

@fakeleft

done - aslakhellesoy/aruba#29

Something went wrong with that request. Please try again.