Cucumber tests are now running, only a few passing, most fail.
This commit is contained in:
parent
a76020108f
commit
264ba8ebf2
@ -5,7 +5,7 @@ Given /^I am not authenticated$/ do
|
||||
end
|
||||
|
||||
Given /^I am an authenticated "([^"]*)"$/ do |role|
|
||||
@member = Site.first.memberships.where(:role => role.downcase).first || FactoryGirl.create(role.downcase.to_sym, :site => Site.first)
|
||||
@member = Locomotive::Site.first.memberships.where(:role => role.downcase).first || FactoryGirl.create(role.downcase.to_sym, :site => Locomotive::Site.first)
|
||||
|
||||
step %{I go to login}
|
||||
step %{I fill in "Email" with "#{@member.account.email}"}
|
||||
|
@ -1,5 +1,5 @@
|
||||
Given %r{^I have a custom model named "([^"]*)" with$} do |name, fields|
|
||||
site = Site.first
|
||||
site = Locomotive::Site.first
|
||||
content_type = FactoryGirl.build(:content_type, :site => site, :name => name)
|
||||
fields.hashes.each do |field|
|
||||
if (target_name = field.delete('target')).present?
|
||||
@ -14,7 +14,7 @@ Given %r{^I have a custom model named "([^"]*)" with$} do |name, fields|
|
||||
end
|
||||
|
||||
Given /^I set up a reverse has_many relationship between "([^"]*)" and "([^"]*)"$/ do |name_1, name_2|
|
||||
site = Site.first
|
||||
site = Locomotive::Site.first
|
||||
|
||||
content_type_1 = site.content_types.where(:name => name_1).first
|
||||
content_type_2 = site.content_types.where(:name => name_2).first
|
||||
@ -30,7 +30,7 @@ Given /^I set up a reverse has_many relationship between "([^"]*)" and "([^"]*)"
|
||||
end
|
||||
|
||||
Given %r{^I have "([^"]*)" as "([^"]*)" values of the "([^"]*)" model$} do |values, field, name|
|
||||
content_type = ContentType.where(:name => name).first
|
||||
content_type = Locomotive::ContentType.where(:name => name).first
|
||||
field = content_type.contents_custom_fields.detect { |f| f.label == field }
|
||||
field.should_not be_nil
|
||||
|
||||
@ -45,7 +45,7 @@ Given %r{^I have "([^"]*)" as "([^"]*)" values of the "([^"]*)" model$} do |valu
|
||||
end
|
||||
|
||||
Given %r{^I have entries for "([^"]*)" with$} do |name, entries|
|
||||
content_type = ContentType.where(:name => name).first
|
||||
content_type = Locomotive::ContentType.where(:name => name).first
|
||||
entries.hashes.each do |entry|
|
||||
content_type.contents.create(entry)
|
||||
end
|
||||
@ -53,7 +53,7 @@ Given %r{^I have entries for "([^"]*)" with$} do |name, entries|
|
||||
end
|
||||
|
||||
When %r{^I change the presentation of the "([^"]*)" model by grouping items by "([^"]*)"$} do |name, field|
|
||||
content_type = ContentType.where(:name => name).first
|
||||
content_type = Locomotive::ContentType.where(:name => name).first
|
||||
field = content_type.contents_custom_fields.detect { |f| f.label == field }
|
||||
content_type.group_by_field_name = field._name
|
||||
content_type.save.should be_true
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Creates a Site record
|
||||
# Creates a Locomotive::Site record
|
||||
#
|
||||
# examples:
|
||||
# - I have the site: "some site" set up
|
||||
@ -18,12 +18,12 @@ Given /^I have a site set up$/ do
|
||||
end
|
||||
|
||||
Given /^I have a designer and an author$/ do
|
||||
FactoryGirl.create(:designer, :site => Site.first)
|
||||
FactoryGirl.create(:author, :site => Site.first)
|
||||
FactoryGirl.create(:designer, :site => Locomotive::Site.first)
|
||||
FactoryGirl.create(:author, :site => Locomotive::Site.first)
|
||||
end
|
||||
|
||||
Then /^I should be a administrator of the "([^"]*)" site$/ do |name|
|
||||
site = Site.where(:name => name).first
|
||||
site = Locomotive::Site.where(:name => name).first
|
||||
m = site.memberships.detect { |m| m.account_id == @admin._id && m.admin? }
|
||||
m.should_not be_nil
|
||||
end
|
||||
|
@ -11,4 +11,4 @@ each do |within, selector|
|
||||
Then step
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,15 +4,16 @@
|
||||
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
||||
# files.
|
||||
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
ENV["RAILS_ROOT"] ||= File.join(File.dirname(__FILE__), '../', '../', 'spec', 'dummy')
|
||||
|
||||
require 'cucumber/rails'
|
||||
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
||||
require 'cucumber/rails/rspec'
|
||||
require 'cucumber/rails/world'
|
||||
|
||||
require 'factory_girl'
|
||||
|
||||
require 'capybara'
|
||||
require 'capybara/rails'
|
||||
require 'capybara/cucumber'
|
||||
@ -67,4 +68,6 @@ ActionController::Base.allow_rescue = false
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../spec/support/carrierwave')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../spec/support/locomotive')
|
||||
|
||||
World(Locomotive::Engine.routes.url_helpers) # Load engine routes
|
||||
|
||||
Locomotive.configure_for_test(true)
|
||||
|
@ -1,4 +1,6 @@
|
||||
module NavigationHelpers
|
||||
include Locomotive::Engine.routes.url_helpers # Load engine routes
|
||||
|
||||
# Maps a name to a path. Used by the
|
||||
#
|
||||
# When /^I go to (.+)$/ do |page_name|
|
||||
@ -11,35 +13,35 @@ module NavigationHelpers
|
||||
when /the home\s?page$/
|
||||
'/'
|
||||
when /login/
|
||||
new_admin_session_path
|
||||
new_locomotive_account_session_path
|
||||
when /logout/
|
||||
destroy_admin_session_path
|
||||
destroy_locomotive_account_session_url
|
||||
when /pages( list)?/
|
||||
admin_pages_path
|
||||
locomotive_pages_path
|
||||
when /new page/
|
||||
new_admin_page_path
|
||||
new_locomotive_page_path
|
||||
when /"(.*)" edition page/
|
||||
page = Site.first.pages.where(:slug => $1).first
|
||||
edit_admin_page_path(page)
|
||||
edit_locomotive_page_path(page)
|
||||
when /theme assets/
|
||||
admin_theme_assets_path
|
||||
locomotive_theme_assets_path
|
||||
when /site settings/
|
||||
edit_admin_current_site_path
|
||||
edit_locomotive_current_site_path
|
||||
when /account settings/
|
||||
edit_admin_my_account_path
|
||||
edit_locomotive_my_account_path
|
||||
when /import page/
|
||||
new_admin_import_path
|
||||
new_locomotive_import_path
|
||||
when /export page/
|
||||
new_admin_export_path
|
||||
new_locomotive_export_path
|
||||
when /the "(.*)" model list page/
|
||||
content_type = Site.first.content_types.where(:name => $1).first
|
||||
admin_contents_path(content_type.slug)
|
||||
content_type = Locomotive::Site.first.content_types.where(:name => $1).first
|
||||
locomotive_contents_path(content_type.slug)
|
||||
when /the "(.*)" model creation page/
|
||||
content_type = Site.first.content_types.where(:name => $1).first
|
||||
new_admin_content_path(content_type.slug)
|
||||
content_type = Locomotive::Site.first.content_types.where(:name => $1).first
|
||||
new_locomotive_content_path(content_type.slug)
|
||||
when /the "(.*)" model edition page/
|
||||
content_type = Site.first.content_types.where(:name => $1).first
|
||||
edit_admin_content_type_path(content_type)
|
||||
content_type = Locomotive::Site.first.content_types.where(:name => $1).first
|
||||
edit_locomotive_content_type_path(content_type)
|
||||
|
||||
# Add more mappings here.
|
||||
# Here is an example that pulls values out of the Regexp:
|
||||
@ -61,58 +63,3 @@ module NavigationHelpers
|
||||
end
|
||||
|
||||
World(NavigationHelpers)
|
||||
|
||||
|
||||
# module NavigationHelpers
|
||||
# # Maps a name to a path. Used by the
|
||||
# #
|
||||
# # When /^I go to (.+)$/ do |page_name|
|
||||
# #
|
||||
# # step definition in web_steps.rb
|
||||
# #
|
||||
# def path_to(page_name)
|
||||
# case page_name
|
||||
#
|
||||
# when /the home\s?page/
|
||||
# '/'
|
||||
# when /login/
|
||||
# new_admin_session_path
|
||||
# when /logout/
|
||||
# destroy_admin_session_path
|
||||
# when /pages( list)?/
|
||||
# admin_pages_path
|
||||
# when /new page/
|
||||
# new_admin_page_path
|
||||
# when /"(.*)" edition page/
|
||||
# page = Site.first.pages.where(:slug => $1).first
|
||||
# edit_admin_page_path(page)
|
||||
# when /theme assets/
|
||||
# admin_theme_assets_path
|
||||
# when /site settings/
|
||||
# edit_admin_current_site_path
|
||||
# when /import page/
|
||||
# new_admin_import_path
|
||||
# when /the "(.*)" model edition page/
|
||||
# content_type = Site.first.content_types.where(:name => $1).first
|
||||
# edit_admin_content_type_path(content_type)
|
||||
#
|
||||
# # Add more mappings here.
|
||||
# # Here is an example that pulls values out of the Regexp:
|
||||
# #
|
||||
# # when /^(.*)'s profile page$/i
|
||||
# # user_profile_path(User.find_by_login($1))
|
||||
#
|
||||
# else
|
||||
# begin
|
||||
# page_name =~ /the (.*) page/
|
||||
# path_components = $1.split(/\s+/)
|
||||
# self.send(path_components.push('path').join('_').to_sym)
|
||||
# rescue Object => e
|
||||
# raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
||||
# "Now, go and add a mapping in #{__FILE__}"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# World(NavigationHelpers)
|
||||
|
Loading…
Reference in New Issue
Block a user