Skip to content

Commit

Permalink
Merge pull request #487 from mvz/fix-final-cuke-failures
Browse files Browse the repository at this point in the history
Fix final cuke failures
  • Loading branch information
maxmeyer authored Sep 4, 2017
2 parents 0ead813 + fb0a771 commit 6820ab3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Feature: Check exit status of commands

Use the `the exit status should be \d`-step to check the exit status of the
last command which was executed.
last command which was finished. If no commands have finished yet, it stops
the one that was started last.

Background:
Given I use a fixture named "cli-app"
Expand Down
24 changes: 12 additions & 12 deletions features/04_aruba_api/filesystem/use_fixtures.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: Use fixtures in your tests
RSpec.describe 'My Feature', :type => :aruba do
describe 'Copy file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
before(:each) { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
Expand All @@ -35,8 +35,8 @@ Feature: Use fixtures in your tests
require 'spec_helper'
RSpec.describe 'My Feature', :type => :aruba do
before :each { copy '%/my_file.txt', 'new_file.txt' }
before :each { run_command 'aruba-test-cli new_file.txt' }
before(:each) { copy '%/my_file.txt', 'new_file.txt' }
before(:each) { run_command 'aruba-test-cli new_file.txt' }
it { expect(last_command_started).to have_output 'Hello Aruba!' }
end
Expand All @@ -56,61 +56,61 @@ Feature: Use fixtures in your tests
Then the specs should all pass

Scenario: Use a fixture for your tests in test/
Given a file named "features/fixtures.feature" with:
Given a file named "spec/fixture_spec.rb" with:
"""
require 'spec_helper'
RSpec.describe 'My Feature', :type => :aruba do
describe 'Copy file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
before(:each) { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
end
end
"""
And a directory named "test/fixtures"
And an empty file named "test/fixtures/fixtures-app/test.txt"
And an empty file named "test/fixtures/song.mp3"
When I run `rspec`
Then the specs should all pass

Scenario: Use a fixture for your tests in spec/
Given a file named "features/fixtures.feature" with:
Given a file named "spec/fixture_spec.rb" with:
"""
require 'spec_helper'
RSpec.describe 'My Feature', :type => :aruba do
describe 'Copy file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
before(:each) { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
end
end
"""
And a directory named "spec/fixtures"
And an empty file named "spec/fixtures/fixtures-app/test.txt"
And an empty file named "spec/fixtures/song.mp3"
When I run `rspec`
Then the specs should all pass

Scenario: Use a fixture for your tests in features/
Given a file named "features/fixtures.feature" with:
Given a file named "spec/fixture_spec.rb" with:
"""
require 'spec_helper'
RSpec.describe 'My Feature', :type => :aruba do
describe 'Copy file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
before(:each) { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
end
end
"""
And a directory named "features/fixtures"
And an empty file named "features/fixtures/fixtures-app/test.txt"
And an empty file named "features/fixtures/song.mp3"
When I run `rspec`
Then the specs should all pass
2 changes: 1 addition & 1 deletion features/07_development_of_aruba/build-aruba.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Feature: Build Aruba Gem
To build the `aruba`-gem you can use the `gem:build`-rake task.

Given I successfully run `rake rubygem:build`
Then the output should match %r<aruba \d+\.\d+\.\d+ built to pkg/aruba-\d+\.\d+\.\d+.gem>
Then the output should match %r<aruba \d+\.\d+\.\d+[\.\w]* built to pkg/aruba-\d+\.\d+\.\d+[\.\w]*\.gem>
12 changes: 12 additions & 0 deletions lib/aruba/cucumber/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@
end

Then(/^the exit status should( not)? be (\d+)$/) do |negated, exit_status|
if last_command_stopped.nil?
last_command_started.stop
end

if negated
expect(last_command_stopped).not_to have_exit_status exit_status.to_i
else
Expand All @@ -276,6 +280,8 @@
end

Then(/^it should( not)? (pass|fail) with "(.*?)"$/) do |negated, pass_fail, expected|
last_command_started.stop

if pass_fail == 'pass'
expect(last_command_stopped).to be_successfully_executed
else
Expand All @@ -290,6 +296,8 @@
end

Then(/^it should( not)? (pass|fail) with:$/) do |negated, pass_fail, expected|
last_command_started.stop

if pass_fail == 'pass'
expect(last_command_stopped).to be_successfully_executed
else
Expand All @@ -304,6 +312,8 @@
end

Then(/^it should( not)? (pass|fail) with exactly:$/) do |negated, pass_fail, expected|
last_command_started.stop

if pass_fail == 'pass'
expect(last_command_stopped).to be_successfully_executed
else
Expand All @@ -318,6 +328,8 @@
end

Then(/^it should( not)? (pass|fail) (?:with regexp?|matching):$/) do |negated, pass_fail, expected|
last_command_started.stop

if pass_fail == 'pass'
expect(last_command_stopped).to be_successfully_executed
else
Expand Down

0 comments on commit 6820ab3

Please sign in to comment.