forked from codegram/bankr
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Gemfile and bootrapped cucumber
- Loading branch information
Showing
7 changed files
with
264 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
source 'http://rubygems.org' | ||
# gem 'rails', :git=>'git://github.com/rails/rails.git' | ||
#gem 'delayed_job' | ||
|
||
group :development do | ||
gem 'git-pivotal', :git => "http://github.com/trydionel/git-pivotal.git" | ||
gem 'slurper' | ||
gem "sqlite3-ruby", '1.2.5' | ||
gem "jeweler" | ||
end | ||
|
||
group :test do | ||
# Latest rspec (2.0 beta) | ||
gem "rspec", ">= 2.0.0.beta.13", :git => "http://github.com/rspec/rspec.git" | ||
gem "rspec-rails", ">= 2.0.0.beta.13", :git => "http://github.com/rspec/rspec-rails.git" | ||
gem "rspec-expectations", ">= 2.0.0.beta.13", :git => "http://github.com/rspec/rspec-expectations.git" | ||
gem "rspec-core", ">= 2.0.0.beta.13", :git => "http://github.com/rspec/rspec-core.git" | ||
gem "rspec-mocks", ">= 2.0.0.beta.13", :git => "http://github.com/rspec/rspec-mocks.git" | ||
# Cucumber gems | ||
gem "capybara" | ||
gem 'capybara-envjs', :require => 'capybara/envjs' | ||
gem "pickle", :git => "git://github.com/codegram/pickle" | ||
gem 'autotest-rails' | ||
gem "cucumber" | ||
gem "cucumber-rails" | ||
gem 'autotest' | ||
gem 'autotest-growl' | ||
gem "webrat" | ||
|
||
gem 'remarkable', '=4.0.0.alpha4' | ||
end | ||
|
||
gem "factory_girl", :require=>false, :git => "git://github.com/thoughtbot/factory_girl.git", :branch => 'rails3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
Feature: something something | ||
In order to something something | ||
A user something something | ||
something something something | ||
Feature: Log to your account | ||
In order to retrieve my bank account information | ||
As a customer | ||
I want to enter my ID and password | ||
|
||
Scenario: something something | ||
Given inspiration | ||
When I create a sweet new gem | ||
Then everyone should see how awesome I am | ||
Scenario: Log in with user and password | ||
Given I visit LaCaixa website | ||
And I follow "Particulares" | ||
When I enter a valid ID and password | ||
Then I should see my name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# "Then I should see 5 articles" | ||
Then /^I should see (\d+) (.+)$/ do |number, name| | ||
assert page.has_xpath?("//*[@class = '#{name.singularize}']", :count => number.to_i) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
# 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' | ||
|
||
module WithinHelpers | ||
def with_scope(locator) | ||
locator ? within(locator) { yield } : yield | ||
end | ||
end | ||
World(WithinHelpers) | ||
|
||
Given /^(?:|I )am on (.+)$/ do |page_name| | ||
visit page_name | ||
end | ||
|
||
When /^(?:|I )go to (.+)$/ do |page_name| | ||
visit page_name | ||
end | ||
|
||
When /^(?:|I )press "([^\"]*)"(?: within "([^\"]*)")?$/ do |button, selector| | ||
with_scope(selector) do | ||
click_button(button) | ||
end | ||
end | ||
|
||
When /^(?:|I )follow "([^\"]*)"(?: within "([^\"]*)")?$/ do |link, selector| | ||
with_scope(selector) do | ||
click_link(link) | ||
end | ||
end | ||
|
||
When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, value, selector| | ||
with_scope(selector) do | ||
fill_in(field, :with => value) | ||
end | ||
end | ||
|
||
When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector| | ||
with_scope(selector) do | ||
fill_in(field, :with => value) | ||
end | ||
end | ||
|
||
# Use this to fill in an entire form with data from a table. Example: | ||
# | ||
# When I fill in the following: | ||
# | Account Number | 5002 | | ||
# | Expiry date | 2009-11-01 | | ||
# | Note | Nice guy | | ||
# | Wants Email? | | | ||
# | ||
# TODO: Add support for checkbox, select og option | ||
# based on naming conventions. | ||
# | ||
When /^(?:|I )fill in the following(?: within "([^\"]*)")?:$/ do |selector, fields| | ||
with_scope(selector) do | ||
fields.rows_hash.each do |name, value| | ||
When %{I fill in "#{name}" with "#{value}"} | ||
end | ||
end | ||
end | ||
|
||
When /^(?:|I )select "([^\"]*)" from "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector| | ||
with_scope(selector) do | ||
select(value, :from => field) | ||
end | ||
end | ||
|
||
When /^(?:|I )check "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector| | ||
with_scope(selector) do | ||
check(field) | ||
end | ||
end | ||
|
||
When /^(?:|I )uncheck "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector| | ||
with_scope(selector) do | ||
uncheck(field) | ||
end | ||
end | ||
|
||
When /^(?:|I )choose "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector| | ||
with_scope(selector) do | ||
choose(field) | ||
end | ||
end | ||
|
||
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"(?: within "([^\"]*)")?$/ do |path, field, selector| | ||
with_scope(selector) do | ||
attach_file(field, path) | ||
end | ||
end | ||
|
||
Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector| | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
page.should have_content(text) | ||
else | ||
assert page.has_content?(text) | ||
end | ||
end | ||
end | ||
|
||
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector| | ||
regexp = Regexp.new(regexp) | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
page.should have_xpath('//*', :text => regexp) | ||
else | ||
assert page.has_xpath?('//*', :text => regexp) | ||
end | ||
end | ||
end | ||
|
||
Then /^(?:|I )should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector| | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
page.should have_no_content(text) | ||
else | ||
assert page.has_no_content?(text) | ||
end | ||
end | ||
end | ||
|
||
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector| | ||
regexp = Regexp.new(regexp) | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
page.should have_no_xpath('//*', :text => regexp) | ||
else | ||
assert page.has_no_xpath?('//*', :text => regexp) | ||
end | ||
end | ||
end | ||
|
||
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain "([^\"]*)"$/ do |field, selector, value| | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
find_field(field).value.should =~ /#{value}/ | ||
else | ||
assert_match(/#{value}/, field_labeled(field).value) | ||
end | ||
end | ||
end | ||
|
||
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should not contain "([^\"]*)"$/ do |field, selector, value| | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
find_field(field).value.should_not =~ /#{value}/ | ||
else | ||
assert_no_match(/#{value}/, find_field(field).value) | ||
end | ||
end | ||
end | ||
|
||
Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should be checked$/ do |label, selector| | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
find_field(label)['checked'].should == 'checked' | ||
else | ||
assert_equal 'checked', field_labeled(label)['checked'] | ||
end | ||
end | ||
end | ||
|
||
Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should not be checked$/ do |label, selector| | ||
with_scope(selector) do | ||
if defined?(Spec::Rails::Matchers) | ||
find_field(label)['checked'].should_not == 'checked' | ||
else | ||
assert_not_equal 'checked', field_labeled(label)['checked'] | ||
end | ||
end | ||
end | ||
|
||
Then /^(?:|I )should be on (.+)$/ do |page_name| | ||
if defined?(Spec::Rails::Matchers) | ||
URI.parse(current_url).path.should == path_to(page_name) | ||
else | ||
assert_equal path_to(page_name), URI.parse(current_url).path | ||
end | ||
end | ||
|
||
Then /^(?:|I )should have the following query string:$/ do |expected_pairs| | ||
actual_params = CGI.parse(URI.parse(current_url).query) | ||
expected_params = Hash[expected_pairs.rows_hash.map{|k,v| [k,[v]]}] | ||
|
||
if defined?(Spec::Rails::Matchers) | ||
actual_params.should == expected_params | ||
else | ||
assert_equal expected_params, actual_params | ||
end | ||
end | ||
|
||
Then /^show me the page$/ do | ||
save_and_open_page | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') | ||
require 'rlacaixa' | ||
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support | ||
require 'cucumber/web/tableish' | ||
|
||
require 'capybara/cucumber' | ||
require 'capybara/session' | ||
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript | ||
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In | ||
# order to ease the transition to Capybara we set the default here. If you'd | ||
# prefer to use XPath just remove this line and adjust any selectors in your | ||
# steps to use the XPath syntax. | ||
Capybara.default_selector = :css | ||
Capybara.javascript_driver = :envjs | ||
|
||
require 'rspec/expectations' |