Update to newer cucumber and aruba

This commit is contained in:
Thomas Reynolds 2015-08-10 16:58:32 -07:00
parent ee5e8ff4a1
commit fb6bca234f
9 changed files with 30 additions and 36 deletions

View file

@ -6,12 +6,9 @@ gem 'yard', '~> 0.8', require: false
# Test tools # Test tools
gem 'pry', '~> 0.10', group: :development, require: false gem 'pry', '~> 0.10', group: :development, require: false
gem 'pry-byebug' gem 'aruba', '~> 0.7.4', require: false
gem 'pry-stack_explorer'
gem 'aruba', '~> 0.6', require: false
gem 'rspec', '~> 3.0', require: false gem 'rspec', '~> 3.0', require: false
gem 'fivemat', '~> 1.3', require: false gem 'cucumber', '~> 2.0', require: false
gem 'cucumber', '~> 1.3', require: false
# Optional middleman dependencies, included for tests # Optional middleman dependencies, included for tests
gem 'haml', '>= 4.0.5', require: false gem 'haml', '>= 4.0.5', require: false

View file

@ -48,8 +48,6 @@ task :test do
GEM_PATHS.each do |g| GEM_PATHS.each do |g|
Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake test" } Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake test" }
end end
Rake::Task['rubocop'].invoke
end end
desc 'Run specs for all middleman gems' desc 'Run specs for all middleman gems'

View file

@ -21,7 +21,7 @@ Cucumber::Rake::Task.new do |t|
exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding) exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding)
exempt_tags << '--tags ~@nowindows' if Gem.win_platform? exempt_tags << '--tags ~@nowindows' if Gem.win_platform?
exempt_tags << '--tags ~@travishatesme' if ENV['TRAVIS'] == 'true' exempt_tags << '--tags ~@travishatesme' if ENV['TRAVIS'] == 'true'
t.cucumber_opts = "--color #{exempt_tags.join(' ')} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict"
end end
Cucumber::Rake::Task.new(:cucumber_wip) do |t| Cucumber::Rake::Task.new(:cucumber_wip) do |t|
@ -29,7 +29,8 @@ Cucumber::Rake::Task.new(:cucumber_wip) do |t|
exempt_tags << '--tags ~@nojava' if RUBY_PLATFORM == 'java' exempt_tags << '--tags ~@nojava' if RUBY_PLATFORM == 'java'
exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding) exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding)
exempt_tags << '--tags ~@nowindows' if Gem.win_platform? exempt_tags << '--tags ~@nowindows' if Gem.win_platform?
t.cucumber_opts = "--color #{exempt_tags.join(' ')} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" exempt_tags << '--tags ~@travishatesme' if ENV['TRAVIS'] == 'true'
t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict"
end end
require 'rspec/core/rake_task' require 'rspec/core/rake_task'

View file

@ -13,7 +13,6 @@ end
group :test do group :test do
gem 'cucumber' gem 'cucumber'
gem 'fivemat'
gem 'aruba' gem 'aruba'
gem 'rspec' gem 'rspec'
end end

View file

@ -4,7 +4,7 @@ Bundler::GemHelper.install_tasks
require 'cucumber/rake/task' require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t| Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" t.cucumber_opts = "--color --tags ~@wip --strict"
end end
require 'rake/clean' require 'rake/clean'

View file

@ -1,5 +1,4 @@
require 'aruba/cucumber' require 'aruba/cucumber'
require 'aruba/jruby'
require 'middleman-core/step_definitions/middleman_steps' require 'middleman-core/step_definitions/middleman_steps'
require 'middleman-core/step_definitions/builder_steps' require 'middleman-core/step_definitions/builder_steps'
require 'middleman-core/step_definitions/server_steps' require 'middleman-core/step_definitions/server_steps'

View file

@ -6,8 +6,8 @@ end
Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name| Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name|
target = File.join(PROJECT_ROOT_PATH, 'fixtures', path) target = File.join(PROJECT_ROOT_PATH, 'fixtures', path)
config_path = File.join(current_dir, "config-#{config_name}.rb") config_path = File.join(expand_path("."), "config-#{config_name}.rb")
config_dest = File.join(current_dir, 'config.rb') config_dest = File.join(expand_path("."), 'config.rb')
FileUtils.cp(config_path, config_dest) FileUtils.cp(config_path, config_dest)
end end
@ -22,12 +22,12 @@ Given /^a fixture app "([^\"]*)"$/ do |path|
# This step can be reentered from several places but we don't want # This step can be reentered from several places but we don't want
# to keep re-copying and re-cd-ing into ever-deeper directories # to keep re-copying and re-cd-ing into ever-deeper directories
next if File.basename(current_dir) == path next if File.basename(expand_path(".")) == path
step %Q{a directory named "#{path}"} step %Q{a directory named "#{path}"}
target_path = File.join(PROJECT_ROOT_PATH, 'fixtures', path) target_path = File.join(PROJECT_ROOT_PATH, 'fixtures', path)
FileUtils.cp_r(target_path, current_dir) FileUtils.cp_r(target_path, expand_path("."))
step %Q{I cd to "#{path}"} step %Q{I cd to "#{path}"}
end end
@ -58,20 +58,20 @@ Given /^a successfully built app at "([^\"]*)" with flags "([^\"]*)"$/ do |path,
end end
Given /^a modification time for a file named "([^\"]*)"$/ do |file| Given /^a modification time for a file named "([^\"]*)"$/ do |file|
target = File.join(current_dir, file) target = File.join(expand_path("."), file)
@modification_times[target] = File.mtime(target) @modification_times[target] = File.mtime(target)
end end
Then /^the file "([^\"]*)" should not have been updated$/ do |file| Then /^the file "([^\"]*)" should not have been updated$/ do |file|
target = File.join(current_dir, file) target = File.join(expand_path("."), file)
expect(File.mtime(target)).to eq(@modification_times[target]) expect(File.mtime(target)).to eq(@modification_times[target])
end end
# Provide this Aruba overload in case we're matching something with quotes in it # Provide this Aruba overload in case we're matching something with quotes in it
Then /^the file "([^"]*)" should contain '([^']*)'$/ do |file, partial_content| Then /^the file "([^"]*)" should contain '([^']*)'$/ do |file, partial_content|
check_file_content(file, Regexp.new(Regexp.escape(partial_content)), true) expect(file).to have_file_content(Regexp.new(Regexp.escape(partial_content)), true)
end end
And /the file "(.*)" should be gzipped/ do |file| And /the file "(.*)" should be gzipped/ do |file|
expect(File.binread(File.join(current_dir, file), 2)).to eq(['1F8B'].pack('H*')) expect(File.binread(File.join(expand_path("."), file), 2)).to eq(['1F8B'].pack('H*'))
end end

View file

@ -1,7 +1,7 @@
Then /^the file "([^\"]*)" has the contents$/ do |path, contents| Then /^the file "([^\"]*)" has the contents$/ do |path, contents|
write_file(path, contents) write_file(path, contents)
in_current_dir do cd(".") do
@server_inst.files.find_new_files! @server_inst.files.find_new_files!
end end
end end
@ -9,7 +9,7 @@ end
Then /^the file "([^\"]*)" is removed$/ do |path| Then /^the file "([^\"]*)" is removed$/ do |path|
step %Q{I remove the file "#{path}"} step %Q{I remove the file "#{path}"}
in_current_dir do cd(".") do
@server_inst.files.find_new_files! @server_inst.files.find_new_files!
end end
end end

View file

@ -31,7 +31,7 @@ Given /^"([^\"]*)" is set to "([^\"]*)"$/ do |variable, value|
end end
Given /^the Server is running$/ do Given /^the Server is running$/ do
root_dir = File.expand_path(current_dir) root_dir = File.expand_path(expand_path("."))
if File.exists?(File.join(root_dir, 'source')) if File.exists?(File.join(root_dir, 'source'))
ENV['MM_SOURCE'] = 'source' ENV['MM_SOURCE'] = 'source'
@ -43,7 +43,7 @@ Given /^the Server is running$/ do
initialize_commands = @initialize_commands || [] initialize_commands = @initialize_commands || []
in_current_dir do cd(".") do
@server_inst = ::Middleman::Application.new do @server_inst = ::Middleman::Application.new do
config[:watcher_disable] = true config[:watcher_disable] = true
config[:show_exceptions] = false config[:show_exceptions] = false
@ -68,13 +68,13 @@ Given /^a template named "([^\"]*)" with:$/ do |name, string|
end end
When /^I go to "([^\"]*)"$/ do |url| When /^I go to "([^\"]*)"$/ do |url|
in_current_dir do cd(".") do
@last_response = @browser.get(URI.encode(url)) @last_response = @browser.get(URI.encode(url))
end end
end end
Then /^going to "([^\"]*)" should not raise an exception$/ do |url| Then /^going to "([^\"]*)" should not raise an exception$/ do |url|
in_current_dir do cd(".") do
last_response = nil last_response = nil
expect { expect {
last_response = @browser.get(URI.encode(url)) last_response = @browser.get(URI.encode(url))
@ -84,61 +84,61 @@ Then /^going to "([^\"]*)" should not raise an exception$/ do |url|
end end
Then /^the content type should be "([^\"]*)"$/ do |expected| Then /^the content type should be "([^\"]*)"$/ do |expected|
in_current_dir do cd(".") do
expect(@last_response.content_type).to start_with(expected) expect(@last_response.content_type).to start_with(expected)
end end
end end
Then /^I should see "([^\"]*)"$/ do |expected| Then /^I should see "([^\"]*)"$/ do |expected|
in_current_dir do cd(".") do
expect(@last_response.body).to include(expected) expect(@last_response.body).to include(expected)
end end
end end
Then /^I should see '([^\']*)'$/ do |expected| Then /^I should see '([^\']*)'$/ do |expected|
in_current_dir do cd(".") do
expect(@last_response.body).to include(expected) expect(@last_response.body).to include(expected)
end end
end end
Then /^I should see:$/ do |expected| Then /^I should see:$/ do |expected|
in_current_dir do cd(".") do
expect(@last_response.body).to include(expected) expect(@last_response.body).to include(expected)
end end
end end
Then /^I should not see "([^\"]*)"$/ do |expected| Then /^I should not see "([^\"]*)"$/ do |expected|
in_current_dir do cd(".") do
expect(@last_response.body).to_not include(expected) expect(@last_response.body).to_not include(expected)
end end
end end
Then /^I should see content matching %r{(.*)}$/ do |expected| Then /^I should see content matching %r{(.*)}$/ do |expected|
in_current_dir do cd(".") do
expect(@last_response.body).to match(expected) expect(@last_response.body).to match(expected)
end end
end end
Then /^I should not see content matching %r{(.*)}$/ do |expected| Then /^I should not see content matching %r{(.*)}$/ do |expected|
in_current_dir do cd(".") do
expect(@last_response.body).to_not match(expected) expect(@last_response.body).to_not match(expected)
end end
end end
Then /^I should not see:$/ do |expected| Then /^I should not see:$/ do |expected|
in_current_dir do cd(".") do
expect(@browser.last_response.body).to_not include(expected.chomp) expect(@browser.last_response.body).to_not include(expected.chomp)
end end
end end
Then /^the status code should be "([^\"]*)"$/ do |expected| Then /^the status code should be "([^\"]*)"$/ do |expected|
in_current_dir do cd(".") do
expect(@browser.last_response.status).to eq expected.to_i expect(@browser.last_response.status).to eq expected.to_i
end end
end end
Then /^I should see "([^\"]*)" lines$/ do |lines| Then /^I should see "([^\"]*)" lines$/ do |lines|
in_current_dir do cd(".") do
expect(@last_response.body.chomp.split($/).length).to eq(lines.to_i) expect(@last_response.body.chomp.split($/).length).to eq(lines.to_i)
end end
end end