Skip to content

Commit

Permalink
Issue dustymabe#27 Adding Cucumber tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hferentschik committed Jun 21, 2016
1 parent 7b9d3e0 commit 562a6b5
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .config/cucumber.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# config/cucumber.yml
##YAML Template
---
default: --profile html

pretty: --format pretty -b
html: --format progress --format html --out=build/features_report.html -b
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build artifacts
pkg
build

# Ruby / Bundler
Gemfile.lock
Expand Down
23 changes: 22 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
require "bundler/gem_tasks"
require 'bundler/gem_tasks'
require 'rake/clean'
require 'cucumber/rake/task'
require 'launchy'

CLOBBER.include('pkg')
CLEAN.include('build')

task :init do
FileUtils.mkdir_p 'build'
end

# Cucumber acceptance test task
Cucumber::Rake::Task.new(:features)
task :features => :init

namespace :features do
desc 'Opens the HTML Cucumber test report'
task :open_report do
Launchy.open('./build/features_report.html')
end
end

4 changes: 4 additions & 0 deletions features/step_definitions/user_home_dir_mount_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
And(/^user's home directory should be mounted$/) do
run("vagrant ssh -c \"ls #{ENV['HOME']}\"")
expect(last_command_started).to have_exit_status(0)
end
14 changes: 14 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'aruba/cucumber'
require 'komenda'

Aruba.configure do |config|
config.exit_timeout = 300
config.activate_announcer_on_command_failure = [:stdout, :stderr]
config.working_directory = 'build/aruba'
end

After do |_scenario|
if File.exist?(File.join(aruba.config.working_directory, 'Vagrantfile'))
Komenda.run('bundle exec vagrant destroy -f', cwd: aruba.config.working_directory, fail_on_fail: true)
end
end
27 changes: 27 additions & 0 deletions features/user_home_dir_mount.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Feature: Mount of user home directory

Scenario Outline: Mounting the user's home directory
Given a file named "Vagrantfile" with:
"""
Vagrant.configure('2') do |config|
config.vm.box = '<box>'
config.vm.synced_folder '.', '/vagrant', disabled: true
if Vagrant::Util::Platform.windows?
target_path = ENV['USERPROFILE'].gsub(/\\/,'/').gsub(/[[:alpha:]]{1}:/){|s|'/' + s.downcase.sub(':', '')}
config.vm.synced_folder ENV['USERPROFILE'], target_path, type: 'sshfs', sshfs_opts_append: '-o umask=000 -o uid=1000 -o gid=1000'
else
config.vm.synced_folder ENV['HOME'], ENV['HOME'], type: 'sshfs', sshfs_opts_append: '-o umask=000 -o uid=1000 -o gid=1000'
end
end
"""
When I successfully run `bundle exec vagrant up --provider <provider>`
Then stdout from "bundle exec vagrant up --provider <provider>" should contain "Installing SSHFS client..."
And stdout from "bundle exec vagrant up --provider <provider>" should contain "Mounting SSHFS shared folder..."
And stdout from "bundle exec vagrant up --provider <provider>" should contain "Folder Successfully Mounted!"
And user's home directory should be mounted

Examples:
| box | provider |
| centos/7 | virtualbox |

8 changes: 6 additions & 2 deletions vagrant-sshfs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Gem::Specification.new do |spec|

spec.add_dependency 'win32-process'

spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency 'bundler', '~> 1.7'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'cucumber', '~> 2.1'
spec.add_development_dependency 'aruba', '~> 0.13'
spec.add_development_dependency 'komenda', '~> 0.1.6'
spec.add_development_dependency 'launchy'
end

0 comments on commit 562a6b5

Please sign in to comment.