aboutsummaryrefslogtreecommitdiffstats
path: root/features/step_definitions
diff options
context:
space:
mode:
authorJamie Winsor <jamie@enmasse.com>2011-08-04 15:39:04 -0700
committerJamie Winsor <jamie@enmasse.com>2011-08-04 15:39:04 -0700
commitee215655cba5820c3ffe0c665ea71c11f15f3bf9 (patch)
treeaa1da7816aecf14c2033dff124cf867f30b7581b /features/step_definitions
parent8bd056e3e8baa108b2e10e460ceeeed3ec7c4c86 (diff)
downloadrefinerycms-blog-ee215655cba5820c3ffe0c665ea71c11f15f3bf9.tar.gz
refinerycms-blog-ee215655cba5820c3ffe0c665ea71c11f15f3bf9.tar.bz2
refinerycms-blog-ee215655cba5820c3ffe0c665ea71c11f15f3bf9.zip
Replace cucumber tag features with rspec request tests
Remove cucumber support from project
Diffstat (limited to 'features/step_definitions')
-rw-r--r--features/step_definitions/tags_steps.rb13
-rw-r--r--features/step_definitions/user_steps.rb42
-rw-r--r--features/step_definitions/web_steps.rb196
3 files changed, 0 insertions, 251 deletions
diff --git a/features/step_definitions/tags_steps.rb b/features/step_definitions/tags_steps.rb
deleted file mode 100644
index d16f758..0000000
--- a/features/step_definitions/tags_steps.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-Given /^there is a blog post titled "([^"]*)" and tagged "([^"]*)"$/ do |title, tag_name|
- @blog_post = Factory.create(:blog_post, :title => title, :tag_list => tag_name)
-end
-
-When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name|
- @blog_post ||= Factory.create(:blog_post, :tag_list => tag_name)
- tag = ::Refinery::BlogPost.tag_counts_on(:tags).first
- visit tagged_posts_path(tag.id, tag_name.parameterize)
-end
-
-Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list|
- ::Refinery::BlogPost.last.tag_list == tag_list.split(', ')
-end
diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb
deleted file mode 100644
index 002fa7d..0000000
--- a/features/step_definitions/user_steps.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-def login(options = {})
- options = {:user => @refinery_user}.merge(options)
- visit new_refinery_user_session_path
- fill_in("refinery_user_login", :with => options[:user].email)
- fill_in("refinery_user_password", :with => 'greenandjuicy')
- click_button("submit_button")
-end
-
-Given /^I am a logged in refinery user$/i do
- @refinery_user ||= Factory(:refinery_user)
- login(:user => @refinery_user)
-end
-
-Given /^I am a logged in refinery translator$/i do
- @refinery_translator ||= Factory(:refinery_translator)
- login(:user => @refinery_translator)
-end
-
-Given /^I am a logged in customer$/i do
- @user ||= Factory(:user)
- login(:user => @user)
-end
-
-Given /^A Refinery user exists$/i do
- @refinery_user ||= Factory(:refinery_user)
-end
-
-Given /^I have a user named "(.*)"$/ do |name|
- @user = Factory(:user, :username => name)
-end
-
-Given /^I have a refinery user named "(.*)"$/i do |name|
- @refinery_user = Factory(:refinery_user, :username => name)
-end
-
-Given /^I have no users$/ do
- ::Refinery::User.delete_all
-end
-
-Then /^I should have ([0-9]+) users?$/ do |count|
- ::Refinery::User.count.should == count.to_i
-end
diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb
deleted file mode 100644
index 22abbf6..0000000
--- a/features/step_definitions/web_steps.rb
+++ /dev/null
@@ -1,196 +0,0 @@
-# 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 'cgi'
-require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
-require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
-
-module WithinHelpers
- def with_scope(locator)
- locator ? within(*selector_for(locator)) { yield } : yield
- end
-end
-World(WithinHelpers)
-
-# Single-line step scoper
-When /^(.*) within (.*[^:])$/ do |step, parent|
- with_scope(parent) { When step }
-end
-
-# Multi-line step scoper
-When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
- with_scope(parent) { When "#{step}:", table_or_string }
-end
-
-Given /^(?:|I )am on (.+)$/ do |page_name|
- visit path_to(page_name)
-end
-
-When /^(?:|I )go to (.+)$/ do |page_name|
- visit path_to(page_name)
-end
-
-When /^(?:|I )press "([^"]*)"$/ do |button|
- click_button(button)
-end
-
-When /^(?:|I )follow "([^"]*)"$/ do |link|
- click_link(link)
-end
-
-When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
- fill_in(field, :with => value)
-end
-
-When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
- fill_in(field, :with => value)
-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:$/ do |fields|
- fields.rows_hash.each do |name, value|
- When %{I fill in "#{name}" with "#{value}"}
- end
-end
-
-When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
- select(value, :from => field)
-end
-
-When /^(?:|I )check "([^"]*)"$/ do |field|
- check(field)
-end
-
-When /^(?:|I )uncheck "([^"]*)"$/ do |field|
- uncheck(field)
-end
-
-When /^(?:|I )choose "([^"]*)"$/ do |field|
- choose(field)
-end
-
-When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
- attach_file(field, File.expand_path(path))
-end
-
-Then /^(?:|I )should see "([^"]*)"$/ do |text|
- if page.respond_to? :should
- page.should have_content(text)
- else
- assert page.has_content?(text)
- end
-end
-
-Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
- regexp = Regexp.new(regexp)
-
- if page.respond_to? :should
- page.should have_xpath('//*', :text => regexp)
- else
- assert page.has_xpath?('//*', :text => regexp)
- end
-end
-
-Then /^(?:|I )should not see "([^"]*)"$/ do |text|
- if page.respond_to? :should
- page.should have_no_content(text)
- else
- assert page.has_no_content?(text)
- end
-end
-
-Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
- regexp = Regexp.new(regexp)
-
- if page.respond_to? :should
- page.should have_no_xpath('//*', :text => regexp)
- else
- assert page.has_no_xpath?('//*', :text => regexp)
- end
-end
-
-Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
- with_scope(parent) do
- field = find_field(field)
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
- if field_value.respond_to? :should
- field_value.should =~ /#{value}/
- else
- assert_match(/#{value}/, field_value)
- end
- end
-end
-
-Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
- with_scope(parent) do
- field = find_field(field)
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
- if field_value.respond_to? :should_not
- field_value.should_not =~ /#{value}/
- else
- assert_no_match(/#{value}/, field_value)
- end
- end
-end
-
-Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
- with_scope(parent) do
- field_checked = find_field(label)['checked']
- if field_checked.respond_to? :should
- field_checked.should be_true
- else
- assert field_checked
- end
- end
-end
-
-Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
- with_scope(parent) do
- field_checked = find_field(label)['checked']
- if field_checked.respond_to? :should
- field_checked.should be_false
- else
- assert !field_checked
- end
- end
-end
-
-Then /^(?:|I )should be on (.+)$/ do |page_name|
- current_path = URI.parse(current_url).path
- if current_path.respond_to? :should
- current_path.should == path_to(page_name)
- else
- assert_equal path_to(page_name), current_path
- end
-end
-
-Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
- query = URI.parse(current_url).query
- actual_params = query ? CGI.parse(query) : {}
- expected_params = {}
- expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
-
- if actual_params.respond_to? :should
- 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