Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

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.
base fork: cucumber/cucumber-rails
...
head fork: cucumber/cucumber-rails
  • 9 commits
  • 9 files changed
  • 0 commit comments
  • 6 contributors
Commits on Jan 09, 2012
@laserlemon laserlemon Add dependency status to README 84e8463
@aslakhellesoy aslakhellesoy Merge pull request #188 from laserlemon/patch-1
Add dependency status to README
fd30714
Commits on Jan 11, 2012
@gavinhughes gavinhughes Change argument syntax for select_date, select_time, and select_datet…
…ime.

New arguement syntax is: select_date(date, :from => +field_label+).
b0ec852
Commits on Jan 17, 2012
@mipearson mipearson Add warning about adding arguments to DatabaseCleaner.strategy 8dfcf9c
Commits on Jan 21, 2012
@mattwynne mattwynne Merge pull request #194 from mipearson/master
Add warning about javascript_strategy overriding DatabaseCleaner strategy
9027ed3
Commits on Jan 24, 2012
@twalpole twalpole support options passed to javascript database strategy fc4feee
Commits on Feb 19, 2012
@aslakhellesoy aslakhellesoy Merge branch 'twalpole-strategy_options' 7e456ae
@aslakhellesoy aslakhellesoy Fix tests 8cdb1b0
@aslakhellesoy aslakhellesoy Release 1.3.0 62641c0
View
10 History.md
@@ -1,3 +1,13 @@
+## [v1.3.0](https://github.com/cucumber/cucumber-rails/compare/v1.2.1...v1.3.0)
+
+### New Features
+
+* JavaScript database strategies should take options ([#192](https://github.com/cucumber/cucumber-rails/issues/192), [#195](https://github.com/cucumber/cucumber-rails/pull/195) Thomas Walpole)
+
+### Changed features
+
+* select_date arguments should be reversed ([#190](https://github.com/cucumber/cucumber-rails/issues/190), [#191](https://github.com/cucumber/cucumber-rails/pull/191) Gavin Hughes)
+
## [v1.2.1](https://github.com/cucumber/cucumber-rails/compare/v1.2.0...v1.2.1)
### New features
View
1  README.md
@@ -1,6 +1,7 @@
# Cucumber-Rails
[![Build Status](https://secure.travis-ci.org/cucumber/cucumber-rails.png)](http://travis-ci.org/cucumber/cucumber-rails)
+[![Dependency Status](https://gemnasium.com/cucumber/cucumber-rails.png)](https://gemnasium.com/cucumber/cucumber-rails)
Cucumber-Rails brings Cucumber to Rails 3.x. For Rails 2x support, see the [Cucumber Wiki](https://github.com/cucumber/cucumber/wiki/Ruby-on-Rails).
View
38 cucumber-rails.gemspec
@@ -3,39 +3,39 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = 'cucumber-rails'
- s.version = '1.2.1'
+ s.version = '1.3.0'
s.authors = ["Aslak Hellesøy", "Dennis Blöte", "Rob Holland"]
s.description = "Cucumber Generator and Runtime for Rails"
s.summary = "#{s.name}-#{s.version}"
s.email = 'cukes@googlegroups.com'
s.homepage = "http://cukes.info"
- s.add_runtime_dependency('cucumber', '>= 1.1.3')
+ s.add_runtime_dependency('cucumber', '>= 1.1.8')
s.add_runtime_dependency('nokogiri', '>= 1.5.0')
s.add_runtime_dependency('capybara', '>= 1.1.2')
- s.add_development_dependency('rails', '>= 3.1.3')
+ s.add_development_dependency('rails', '>= 3.2.1')
s.add_development_dependency('rake', '>= 0.9.2.2')
- s.add_development_dependency('bundler', '>= 1.0.21')
- s.add_development_dependency('aruba', '>= 0.4.7')
+ s.add_development_dependency('bundler', '>= 1.0.22')
+ s.add_development_dependency('aruba', '>= 0.4.11')
s.add_development_dependency('sqlite3', '>= 1.3.5')
- s.add_development_dependency('rspec', '>= 2.7.0')
- s.add_development_dependency('rspec-rails', '>= 2.7.0')
- s.add_development_dependency('ammeter', '>= 0.2.1')
- s.add_development_dependency('factory_girl', '>= 2.3.2')
- s.add_development_dependency('database_cleaner', '>= 0.7.0')
- s.add_development_dependency('mongoid', '>= 2.3.4')
- s.add_development_dependency('bson_ext', '>= 1.5.1')
+ s.add_development_dependency('rspec', '~> 2.7.0') # Bump when cucumber bumps it
+ s.add_development_dependency('rspec-rails', '~> 2.7.0')
+ s.add_development_dependency('ammeter', '>= 0.2.2')
+ s.add_development_dependency('factory_girl', '>= 2.6.0')
+ s.add_development_dependency('database_cleaner', '>= 0.7.1')
+ s.add_development_dependency('mongoid', '>= 2.4.4')
+ s.add_development_dependency('bson_ext', '>= 1.5.2')
# Various Stuff that Rails 3.1 puts inside apps.
- s.add_development_dependency('turn', '>= 0.8.3')
- s.add_development_dependency('sass-rails', '>= 3.1.5')
- s.add_development_dependency('coffee-rails', '>= 3.1.1')
- s.add_development_dependency('uglifier', '>= 1.1.0')
- s.add_development_dependency('jquery-rails', '>= 1.0.19')
+ s.add_development_dependency('turn', '>= 0.9.3')
+ s.add_development_dependency('sass-rails', '>= 3.2.4')
+ s.add_development_dependency('coffee-rails', '>= 3.2.2')
+ s.add_development_dependency('uglifier', '>= 1.2.3')
+ s.add_development_dependency('jquery-rails', '>= 2.0.0')
# For Documentation:
- s.add_development_dependency('yard', '~> 0.7.4')
- s.add_development_dependency('rdoc', '~> 3.11')
+ s.add_development_dependency('yard', '~> 0.7.5')
+ s.add_development_dependency('rdoc', '~> 3.12')
s.add_development_dependency('rdiscount', '~> 1.6.8')
s.add_development_dependency('bcat', '~> 0.6.2')
View
7 features/capybara_javascript_drivers.feature
@@ -1,3 +1,4 @@
+@focus
Feature: Capybara Javascript Drivers
Background: A simple calendar app
@@ -6,15 +7,15 @@ Feature: Capybara Javascript Drivers
And I write to "features/step_definitions/date_time_steps.rb" with:
"""
When /^(?:|I )select "([^"]+)" as the "([^"]+)" time$/ do |time, selector|
- select_time(selector, :with => time)
+ select_time(time, :from => selector)
end
When /^(?:|I )select "([^"]+)" as the "([^"]+)" date$/ do |date, selector|
- select_date(selector, :with => date)
+ select_date(date, :from => selector)
end
When /^(?:|I )select "([^"]+)" as the "([^"]+)" date and time$/ do |datetime, selector|
- select_datetime(selector, :with => datetime)
+ select_datetime(datetime, :from => selector)
end
"""
View
33 features/choose_javascript_database_strategy.feature
@@ -100,3 +100,36 @@ Feature: Choose javascript database strategy
2 scenarios (2 passed)
5 steps (5 passed)
"""
+ Scenario: Set the strategy to truncation with an except option and run a javascript scenario.
+ Given I append to "features/env.rb" with:
+ """
+ Cucumber::Rails::Database.javascript_strategy = :truncation, {:except=>%w[widgets]}
+ """
+ And I write to "features/widgets.feature" with:
+ """
+ @javascript
+ Feature:
+ Scenario:
+ When I create 3 widgets
+ Then I should have 3 widgets
+
+ Scenario:
+ Then I should have 3 widgets
+ """
+ And I write to "features/step_definitions/widget_steps.rb" with:
+ """
+ Given /created? (\d) widgets/ do |num|
+ num.to_i.times { Widget.create! }
+ end
+
+ Then /should have (\d) widgets/ do |num|
+ Widget.count.should == num.to_i
+ end
+ """
+ When I run the cukes
+ Then it should pass with:
+ """
+ 2 scenarios (2 passed)
+ 3 steps (3 passed)
+ """
+
View
8 features/no_database.feature
@@ -1,8 +1,9 @@
+@announce
Feature: No Database
Allow Cucumber to work with a Rails app without a database
Scenario: No ActiveRecord and DatabaseCleaner
- Given I have created a new Rails 3 app "rails-3-app" and installed cucumber-rails
+ Given I have created a new Rails 3 app with no database and installed cucumber-rails
# Turn off ActiveRecord
And I write to "config/application.rb" with:
"""
@@ -15,14 +16,13 @@ Feature: No Database
Bundler.require(:default, Rails.env) if defined?(Bundler)
- module Rails3App
+ module TestApp
class Application < Rails::Application
config.encoding = "utf-8"
config.filter_parameters += [:password]
end
end
"""
- And I remove the file "config/database.yml"
And I overwrite "features/support/env.rb" with:
"""
require 'cucumber/rails'
@@ -46,7 +46,7 @@ Feature: No Database
"""
And I write to "config/routes.rb" with:
"""
- Rails3App::Application.routes.draw do
+ TestApp::Application.routes.draw do
resources :posts
end
"""
View
27 lib/cucumber/rails/capybara/select_dates_and_times.rb
@@ -3,32 +3,29 @@ module Rails
module Capybara
# This module defines methods for selecting dates and times
module SelectDatesAndTimes
- # Select a Rails date with label +field+
- # The +options+ hash should contain a Date parseable date (as a string)
- def select_date(field, options)
- date = Date.parse(options[:with])
- base_dom_id = get_base_dom_id_from_label_tag(field)
+ # Select a Rails date. Options has must include :from => +label+
+ def select_date(date, options)
+ date = Date.parse(date)
+ base_dom_id = get_base_dom_id_from_label_tag(options[:from])
find(:xpath, ".//select[@id='#{base_dom_id}_1i']").select(date.year.to_s)
find(:xpath, ".//select[@id='#{base_dom_id}_2i']").select(I18n.l date, :format => '%B')
find(:xpath, ".//select[@id='#{base_dom_id}_3i']").select(date.day.to_s)
end
- # Select a Rails time with label +field+
- # The +options+ hash should contain a Time parseable time (as a string)
- def select_time(field, options)
- time = Time.zone.parse(options[:with])
- base_dom_id = get_base_dom_id_from_label_tag(field)
+ # Select a Rails time. Options has must include :from => +label+
+ def select_time(time, options)
+ time = Time.zone.parse(time)
+ base_dom_id = get_base_dom_id_from_label_tag(options[:from])
find(:xpath, ".//select[@id='#{base_dom_id}_4i']").select(time.hour.to_s.rjust(2, '0'))
find(:xpath, ".//select[@id='#{base_dom_id}_5i']").select(time.min.to_s.rjust(2, '0'))
end
- # Select a Rails date and time with label +field+
- # The +options+ hash should contain a Date/Time parseable time (as a string)
- def select_datetime(field, options)
- select_date(field, options)
- select_time(field, options)
+ # Select a Rails datetime. Options has must include :from => +label+
+ def select_datetime(datetime, options)
+ select_date(datetime, options)
+ select_time(datetime, options)
end
private
View
13 lib/cucumber/rails/database.rb
@@ -8,7 +8,8 @@ class InvalidStrategy < ArgumentError;end
class << self
- def javascript_strategy=(strategy)
+ def javascript_strategy=(args)
+ strategy, *strategy_opts = args
strategy_type =
case strategy
when Symbol
@@ -16,8 +17,8 @@ def javascript_strategy=(strategy)
when Class
strategy
end
-
- @strategy = strategy_type.new
+
+ @strategy = strategy_type.new(*strategy_opts)
validate_interface!
end
@@ -70,9 +71,13 @@ def before_non_js
end
class Strategy
+ def initialize(options={})
+ @options=options
+ end
+
def before_js(strategy)
@original_strategy = DatabaseCleaner.connections.first.strategy # that feels like a nasty hack
- DatabaseCleaner.strategy = strategy
+ DatabaseCleaner.strategy = strategy, @options
end
def before_non_js
View
5 lib/generators/cucumber/install/templates/support/_rails_each_run.rb.erb
@@ -27,7 +27,10 @@ end
# See the DatabaseCleaner documentation for details. Example:
#
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
-# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
+# # { :except => [:widgets] } may not do what you expect here
+# # as tCucumber::Rails::Database.javascript_strategy overrides
+# # this setting.
+# DatabaseCleaner.strategy = :truncation
# end
#
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do

No commit comments for this range

Something went wrong with that request. Please try again.