Skip to content

Commit

Permalink
updating cucumber version
Browse files Browse the repository at this point in the history
  • Loading branch information
Patryk Peszko authored and XING Engineering Dudes committed Feb 27, 2010
1 parent c99947d commit 835f332
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# IMPORTANT: This file was generated by Cucumber 0.4.4
# Edit at your own peril - it's recommended to regenerate this file
# in the future when you upgrade to a newer version of Cucumber.
# Consider adding your own code to a new file instead of editing this one.
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.


require 'uri'
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))

# Commonly used webrat steps
Expand Down Expand Up @@ -116,72 +119,141 @@
choose(field)
end

When /^(?:|I )attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
attach_file(field, path)
# Adds support for validates_attachment_content_type. Without the mime-type getting
# passed to attach_file() you will get a "Photo file is not one of the allowed file types."
# error message
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field|
type = path.split(".")[1]

case type
when "jpg"
type = "image/jpg"
when "jpeg"
type = "image/jpeg"
when "png"
type = "image/png"
when "gif"
type = "image/gif"
end

attach_file(field, path, type)
end

Then /^(?:|I )should see "([^\"]*)"$/ do |text|
response.should contain(text)
if defined?(Spec::Rails::Matchers)
response.should contain(text)
else
assert_contain text
end
end

Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
within(selector) do |content|
content.should contain(text)
if defined?(Spec::Rails::Matchers)
content.should contain(text)
else
assert content.include?(text)
end
end
end

Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
regexp = Regexp.new(regexp)
response.should contain(regexp)
if defined?(Spec::Rails::Matchers)
response.should contain(regexp)
else
assert_contain regexp
end
end

Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
within(selector) do |content|
regexp = Regexp.new(regexp)
content.should contain(regexp)
if defined?(Spec::Rails::Matchers)
content.should contain(regexp)
else
assert content =~ regexp
end
end
end

Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
response.should_not contain(text)
if defined?(Spec::Rails::Matchers)
response.should_not contain(text)
else
assert_not_contain text
end
end

Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
within(selector) do |content|
content.should_not contain(text)
if defined?(Spec::Rails::Matchers)
content.should_not contain(text)
else
assert !content.include?(text)
end
end
end

Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
regexp = Regexp.new(regexp)
response.should_not contain(regexp)
if defined?(Spec::Rails::Matchers)
response.should_not contain(regexp)
else
assert_not_contain regexp
end
end

Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
within(selector) do |content|
regexp = Regexp.new(regexp)
content.should_not contain(regexp)
if defined?(Spec::Rails::Matchers)
content.should_not contain(regexp)
else
assert content !~ regexp
end
end
end

Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
field_labeled(field).value.should =~ /#{value}/
if defined?(Spec::Rails::Matchers)
field_labeled(field).value.should =~ /#{value}/
else
assert_match(/#{value}/, field_labeled(field).value)
end
end

Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
field_labeled(field).value.should_not =~ /#{value}/
if defined?(Spec::Rails::Matchers)
field_labeled(field).value.should_not =~ /#{value}/
else
assert_no_match(/#{value}/, field_labeled(field).value)
end
end

Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
field_labeled(label).should be_checked
if defined?(Spec::Rails::Matchers)
field_labeled(label).should be_checked
else
assert field_labeled(label).checked?
end
end

Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
field_labeled(label).should_not be_checked
if defined?(Spec::Rails::Matchers)
field_labeled(label).should_not be_checked
else
assert !field_labeled(label).checked?
end
end

Then /^(?:|I )should be on (.+)$/ do |page_name|
URI.parse(current_url).path.should == path_to(page_name)
current_path = URI.parse(current_url).select(:path, :query).compact.join('?')
if defined?(Spec::Rails::Matchers)
current_path.should == path_to(page_name)
else
assert_equal path_to(page_name), current_path
end
end

Then /^show me the page$/ do
Expand Down
31 changes: 0 additions & 31 deletions features/support/version_check.rb

This file was deleted.

27 changes: 14 additions & 13 deletions lib/tasks/cucumber.rake
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# This file was generated by
# Find vendored gem or plugin of cucumber
vendored_cucumber_dir = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*"].first
$LOAD_PATH.unshift("#{vendored_cucumber_dir}/lib") unless vendored_cucumber_dir.nil?
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.

unless ARGV.any? {|a| a =~ /^gems/}

unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks

vendored_cucumber_bin = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?

begin
require 'cucumber/rake/task'

# Use vendored cucumber binary if possible. If it's not vendored,
# Cucumber::Rake::Task will automatically use installed gem's cucumber binary
vendored_cucumber_binary = "#{vendored_cucumber_dir}/bin/cucumber" unless vendored_cucumber_dir.nil?

namespace :cucumber do
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
t.binary = vendored_cucumber_binary
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
t.fork = true # You may get faster startup if you set this to false
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
t.profile = 'default'
end

Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
t.binary = vendored_cucumber_binary
t.binary = vendored_cucumber_bin
t.fork = true # You may get faster startup if you set this to false
t.cucumber_opts = "--color --tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
t.profile = 'wip'
end

desc 'Run all features'
Expand Down
13 changes: 3 additions & 10 deletions script/cucumber
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
#!/usr/bin/env ruby

vendored_cucumber_binary = Dir[File.join(File.dirname(__FILE__),
'..',
'vendor',
'{gems,plugins}',
'cucumber*',
'bin',
'cucumber')].first

if vendored_cucumber_binary
load File.expand_path(vendored_cucumber_binary)
vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
if vendored_cucumber_bin
load File.expand_path(vendored_cucumber_bin)
else
require 'rubygems' unless ENV['NO_RUBYGEMS']
require 'cucumber'
Expand Down

0 comments on commit 835f332

Please sign in to comment.