diff --git a/Gemfile b/Gemfile
index 14ee72e..7c097b1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -53,9 +53,10 @@ group :test do
end
group :cucumber do
- gem 'cucumber-rails', '~> 1.0.6', :require => false
gem 'capybara', '~> 2.1.0'
- gem 'cucumber', '~> 1.0.6'
+ gem 'launchy'
+ gem 'cucumber', '~> 1.3.20'
+ gem 'cucumber-rails', '~> 1.4.2', :require => false
gem 'database_cleaner', '~> 1.2.0'
gem 'selenium-webdriver', '~> 2.39.0'
end
diff --git a/app/views/search/_article_description.html.erb b/app/views/search/_article_description.html.erb
index cec29d1..01e9cf6 100644
--- a/app/views/search/_article_description.html.erb
+++ b/app/views/search/_article_description.html.erb
@@ -6,7 +6,7 @@
<% if !article.body.blank? %>
<% description = strip_tags(article.body.to_s) %>
<% description.gsub!(/\s{2,}/, ' ') %>
- <% description = excerpt(description, description.first(3), 200) %>
+ <% description = excerpt description, description.first(3), radius: 200 %>
<%= description %> |
<% else %>
diff --git a/app/views/search/_full_enterprise.html.erb b/app/views/search/_full_enterprise.html.erb
index 5b4fafd..38de832 100644
--- a/app/views/search/_full_enterprise.html.erb
+++ b/app/views/search/_full_enterprise.html.erb
@@ -12,7 +12,7 @@
<% elsif enterprise.home_page and enterprise.home_page.body %>
<% body_stripped = strip_tags(enterprise.home_page.body) %>
<% end %>
- <%= excerpt(body_stripped, body_stripped.first(3), 200) if body_stripped %>
+ <%= excerpt body_stripped, body_stripped.first(3), radius: 200 if body_stripped %>
<%= _("City") %>
diff --git a/app/views/search/_full_product.html.erb b/app/views/search/_full_product.html.erb
index c8f9ec6..541cae1 100644
--- a/app/views/search/_full_product.html.erb
+++ b/app/views/search/_full_product.html.erb
@@ -49,7 +49,7 @@
<% if product.description %>
<% desc_stripped = strip_tags(product.description) %>
- <%= _('Description') %> <%= excerpt(desc_stripped, desc_stripped.first(3), 300) %>
+ <%= _('Description') %> <%= excerpt desc_stripped, desc_stripped.first(3), radius: 300 %>
<% end %>
diff --git a/app/views/search/_image.html.erb b/app/views/search/_image.html.erb
index dbb3080..8e129fb 100644
--- a/app/views/search/_image.html.erb
+++ b/app/views/search/_image.html.erb
@@ -26,7 +26,7 @@
<% end %>
<% elsif image.is_a? Gallery %>
- <% r = image.children.order(updated_at).where('type = ?', 'UploadedFile').last(3) %>
+ <% r = image.children.order(:updated_at).where('type = ?', 'UploadedFile').last(3) %>
<% if r.length > 0 %>
<% r.each_index do |i| img = r[i] %>
<%= link_to '', img.view_url, :class => "search-image-pic pic-num#{i+1}",
diff --git a/features/step_definitions/content_steps.rb b/features/step_definitions/content_steps.rb
index 3a99ed5..945770f 100644
--- a/features/step_definitions/content_steps.rb
+++ b/features/step_definitions/content_steps.rb
@@ -3,7 +3,7 @@ When /^I create a content of type "([^\"]*)" with the following data$/ do |conte
click_link content_type
fields.rows_hash.each do |name, value|
- When %{I fill in "#{name}" with "#{value}"}
+ step %{I fill in "#{name}" with "#{value}"}
end
click_button "Save"
@@ -19,4 +19,4 @@ And /^I add to "([^\"]*)" the following exception "([^\"]*)"$/ do |article_name,
article.article_privacy_exceptions << my_user
article.save
-end
\ No newline at end of file
+end
diff --git a/features/step_definitions/create_community_steps.rb b/features/step_definitions/create_community_steps.rb
index 5bd09f9..009f8a8 100644
--- a/features/step_definitions/create_community_steps.rb
+++ b/features/step_definitions/create_community_steps.rb
@@ -1,7 +1,7 @@
include DatesHelper
Given /^I create community "(.+)"$/ do |community|
- Given %{I go to admin_user's control panel}
+ step %{I go to admin_user's control panel}
click_link('Manage my groups')
click_link('Create a new community')
fill_in("Name", :with => community)
@@ -9,19 +9,19 @@ Given /^I create community "(.+)"$/ do |community|
end
Given /^I approve community "(.+)"$/ do |community|
- task = CreateCommunity.all.select {|c| c.name == community}.first
- Given %{I go to admin_user's control panel}
- click_link('Process requests')
- choose("decision-finish-#{task.id}")
- first(:button, 'Apply!').click
+ task = CreateCommunity.all.select {|c| c.name == community}.first
+ step %{I go to admin_user's control panel}
+ click_link('Process requests')
+ choose("decision-finish-#{task.id}")
+ first(:button, 'Apply!').click
end
Given /^I reject community "(.+)"$/ do |community|
- task = CreateCommunity.all.select {|c| c.name == community}.first
- Given %{I go to admin_user's control panel}
- click_link('Process requests')
- choose("decision-cancel-#{task.id}")
- first(:button, 'Apply!').click
+ task = CreateCommunity.all.select {|c| c.name == community}.first
+ step %{I go to admin_user's control panel}
+ click_link('Process requests')
+ choose("decision-cancel-#{task.id}")
+ first(:button, 'Apply!').click
end
Then /^I should see "([^\"]*)"'s creation date$/ do |community|
diff --git a/features/step_definitions/documentation_steps.rb b/features/step_definitions/documentation_steps.rb
index ed99fe1..0e59484 100644
--- a/features/step_definitions/documentation_steps.rb
+++ b/features/step_definitions/documentation_steps.rb
@@ -1,4 +1,4 @@
-require File.join(Rails.root, 'test', 'noosfero_doc_test')
+require File.join(Rails.root, 'test', 'support', 'noosfero_doc_test')
include Noosfero::DocTest
Given 'the documentation is built' do
diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb
index 8172eb1..bda4d53 100644
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -286,13 +286,13 @@ Given /^the following price details?$/ do |table|
end
Given /^I am logged in as "(.+)"$/ do |username|
- Given %{I go to logout page}
- And %{I go to login page}
- And %{I fill in "main_user_login" with "#{username}"}
- And %{I fill in "user_password" with "123456"}
- When %{I press "Log in"}
- And %{I go to #{username}'s control panel}
- Then %{I should be on #{username}'s control panel}
+ step %{I go to logout page}
+ step %{I go to login page}
+ step %{I fill in "main_user_login" with "#{username}"}
+ step %{I fill in "user_password" with "123456"}
+ step %{I press "Log in"}
+ step %{I go to #{username}'s control panel}
+ step %{I should be on #{username}'s control panel}
@current_user = username
end
@@ -331,8 +331,9 @@ Given /^organization_approval_method is "(.+)" on environment$/ do |approval_met
e.save
end
-Given /^"(.+)" is a member of "(.+)"$/ do |person,profile|
- Profile.find_by_name(profile).add_member(Profile.find_by_name(person))
+Given /^"(.+)" is a member of "(.+)"$/ do |person, profile|
+ person, profile = Profile.where(name: person).first, Profile.where(name: profile).first
+ profile.affiliate person, Profile::Roles.member(profile.environment.id)
end
Then /^"(.+)" should be a member of "(.+)"$/ do |person,profile|
@@ -459,13 +460,13 @@ Given /^the following environment configuration$/ do |table|
end
Then /^I should be logged in as "(.+)"$/ do |username|
- When %{I go to #{username}'s control panel}
- Then %{I should be on #{username}'s control panel}
+ step %{I go to #{username}'s control panel}
+ step %{I should be on #{username}'s control panel}
end
Then /^I should not be logged in as "(.+)"$/ do |username|
- When %{I go to #{username}'s control panel}
- Then %{I should be on login page}
+ step %{I go to #{username}'s control panel}
+ step %{I should be on login page}
end
Given /^the profile "(.+)" has no blocks$/ do |profile|
@@ -637,9 +638,9 @@ Given /^the following tags$/ do |table|
end
When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query|
- When %{I go to the search #{asset} page}
- And %{I fill in "search-input" with "#{query}"}
- And %{I press "Search"}
+ step %{I go to the search #{asset} page}
+ step %{I fill in "search-input" with "#{query}"}
+ step %{I press "Search"}
end
Then /^I should see ([^\"]*)'s product image$/ do |product_name|
diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb
index 5da1b6b..213c8d5 100644
--- a/features/step_definitions/web_steps.rb
+++ b/features/step_definitions/web_steps.rb
@@ -69,7 +69,7 @@ end
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}"}
+ step %{I fill in "#{name}" with "#{value}"}
end
end
end
diff --git a/features/support/debug.rb b/features/support/debug.rb
new file mode 100644
index 0000000..a7694b9
--- /dev/null
+++ b/features/support/debug.rb
@@ -0,0 +1,23 @@
+
+# `LAUNCHY=1 cucumber` to open page on failure
+After do |scenario|
+ save_and_open_page if ENV['LAUNCHY'] and scenario.failed?
+end
+
+# `FAST=1 cucumber` to stop on first failure
+After do |scenario|
+ Cucumber.wants_to_quit = ENV['FAST'] and scenario.failed?
+end
+
+# `DEBUG=1 cucumber` to drop into debugger
+Before do |scenario|
+ next unless ENV['DEBUG']
+ puts "Debugging scenario: #{scenario.title}"
+ if respond_to? :debugger
+ debugger
+ elsif binding.respond_to? :pry
+ binding.pry
+ else
+ puts "Can't find debugger or pry to debug"
+ end
+end
diff --git a/features/support/env.rb b/features/support/env.rb
index cf2ae2b..f34175d 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -4,9 +4,8 @@
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
-require 'cucumber/rails'
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
+require 'cucumber/rails'
Capybara.ignore_hidden_elements = true
@@ -16,8 +15,8 @@ Capybara.ignore_hidden_elements = true
# Capybara.default_selector = :xpath
# By default, any exception happening in your Rails application will bubble up
-# to Cucumber so that your scenario will fail. This is a different from how
-# your application behaves in the production environment, where an error page will
+# to Cucumber so that your scenario will fail. This is a different from how
+# your application behaves in the production environment, where an error page will
# be rendered instead.
#
# Sometimes we want to override this default behaviour and allow Rails to rescue
diff --git a/plugins/community_track/lib/community_track_plugin/track_helper.rb b/plugins/community_track/lib/community_track_plugin/track_helper.rb
index c2249fe..2ae1060 100644
--- a/plugins/community_track/lib/community_track_plugin/track_helper.rb
+++ b/plugins/community_track/lib/community_track_plugin/track_helper.rb
@@ -8,7 +8,7 @@ module CommunityTrackPlugin::TrackHelper
def track_card_lead(track)
lead_stripped = strip_tags(track.lead)
- excerpt(lead_stripped, lead_stripped.first(3), track.image ? 180 : 300)
+ excerpt lead_stripped, lead_stripped.first(3), radius: if track.image then 180 else 300 end
end
def track_color_style(track)
diff --git a/plugins/sub_organizations/views/sub_organizations_plugin_profile/_full_related_organizations.html.erb b/plugins/sub_organizations/views/sub_organizations_plugin_profile/_full_related_organizations.html.erb
index 6bac536..6827d41 100644
--- a/plugins/sub_organizations/views/sub_organizations_plugin_profile/_full_related_organizations.html.erb
+++ b/plugins/sub_organizations/views/sub_organizations_plugin_profile/_full_related_organizations.html.erb
@@ -17,7 +17,7 @@
<% elsif organization.home_page and organization.home_page.body %>
<% body_stripped = strip_tags(organization.home_page.body) %>
<% end %>
- <%= excerpt(body_stripped, body_stripped.first(3), 200) if body_stripped %>
+ <%= excerpt body_stripped, body_stripped.first(3), radius: 200 if body_stripped %>
<%= c_("City") %>
--
libgit2 0.21.2