Commit a03f0c92fac497a540d17168d944d100d4a21e7f
1 parent
3b68729e
Exists in
master
and in
27 other branches
rails3: fix some cucumber tests
Showing
9 changed files
with
28 additions
and
28 deletions
Show diff stats
app/models/article.rb
@@ -2,7 +2,7 @@ require 'hpricot' | @@ -2,7 +2,7 @@ require 'hpricot' | ||
2 | 2 | ||
3 | class Article < ActiveRecord::Base | 3 | class Article < ActiveRecord::Base |
4 | 4 | ||
5 | - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits | 5 | + attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder |
6 | 6 | ||
7 | acts_as_having_image | 7 | acts_as_having_image |
8 | 8 |
app/models/block.rb
1 | class Block < ActiveRecord::Base | 1 | class Block < ActiveRecord::Base |
2 | 2 | ||
3 | - attr_accessible :title, :display, :limit, :box_id | 3 | + attr_accessible :title, :display, :limit, :box_id, :posts_per_page, :visualization_format, :language |
4 | 4 | ||
5 | # to be able to generate HTML | 5 | # to be able to generate HTML |
6 | include ActionView::Helpers::UrlHelper | 6 | include ActionView::Helpers::UrlHelper |
app/models/event.rb
@@ -3,7 +3,7 @@ require 'builder' | @@ -3,7 +3,7 @@ require 'builder' | ||
3 | 3 | ||
4 | class Event < Article | 4 | class Event < Article |
5 | 5 | ||
6 | - attr_accessible :start_date, :end_date, :link | 6 | + attr_accessible :start_date, :end_date, :link, :address |
7 | 7 | ||
8 | def self.type_name | 8 | def self.type_name |
9 | _('Event') | 9 | _('Event') |
app/models/organization.rb
1 | # Represents any organization of the system | 1 | # Represents any organization of the system |
2 | class Organization < Profile | 2 | class Organization < Profile |
3 | 3 | ||
4 | - attr_accessible :moderated_articles, :foundation_year, :contact_person, :acronym, :legal_form, :economic_activity, :management_information | 4 | + attr_accessible :moderated_articles, :foundation_year, :contact_person, :acronym, :legal_form, :economic_activity, :management_information, :cnpj, :display_name |
5 | 5 | ||
6 | SEARCH_FILTERS += %w[ | 6 | SEARCH_FILTERS += %w[ |
7 | more_popular | 7 | more_popular |
app/models/product.rb
@@ -11,7 +11,7 @@ class Product < ActiveRecord::Base | @@ -11,7 +11,7 @@ class Product < ActiveRecord::Base | ||
11 | 11 | ||
12 | SEARCH_DISPLAYS = %w[map full] | 12 | SEARCH_DISPLAYS = %w[map full] |
13 | 13 | ||
14 | - attr_accessible :name, :product_category, :highlighted, :price, :enterprise, :image_builder, :description | 14 | + attr_accessible :name, :product_category, :highlighted, :price, :enterprise, :image_builder, :description, :available, :qualifiers |
15 | 15 | ||
16 | def self.default_search_display | 16 | def self.default_search_display |
17 | 'full' | 17 | 'full' |
app/models/profile.rb
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | # which by default is the one returned by Environment:default. | 3 | # which by default is the one returned by Environment:default. |
4 | class Profile < ActiveRecord::Base | 4 | class Profile < ActiveRecord::Base |
5 | 5 | ||
6 | - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code | 6 | + attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email |
7 | 7 | ||
8 | # use for internationalizable human type names in search facets | 8 | # use for internationalizable human type names in search facets |
9 | # reimplement on subclasses | 9 | # reimplement on subclasses |
config/routes.rb
@@ -61,7 +61,7 @@ Noosfero::Application.routes.draw do | @@ -61,7 +61,7 @@ Noosfero::Application.routes.draw do | ||
61 | match 'profile/:profile/events', :controller => 'events', :action => 'events', :profile => /#{Noosfero.identifier_format}/ | 61 | match 'profile/:profile/events', :controller => 'events', :action => 'events', :profile => /#{Noosfero.identifier_format}/ |
62 | 62 | ||
63 | # catalog | 63 | # catalog |
64 | - match 'catalog/:profile', :controller => 'catalog', :action => 'index', :profile => /#{Noosfero.identifier_format}/ | 64 | + match 'catalog/:profile', :controller => 'catalog', :action => 'index', :profile => /#{Noosfero.identifier_format}/, :as => :catalog |
65 | 65 | ||
66 | # invite | 66 | # invite |
67 | match 'profile/:profile/invite/friends', :controller => 'invite', :action => 'select_address_book', :profile => /#{Noosfero.identifier_format}/ | 67 | match 'profile/:profile/invite/friends', :controller => 'invite', :action => 'select_address_book', :profile => /#{Noosfero.identifier_format}/ |
features/step_definitions/noosfero_steps.rb
@@ -14,7 +14,7 @@ Given /^the following users?$/ do |table| | @@ -14,7 +14,7 @@ Given /^the following users?$/ do |table| | ||
14 | end | 14 | end |
15 | 15 | ||
16 | Given /^"(.+)" is (invisible|visible)$/ do |user, visibility| | 16 | Given /^"(.+)" is (invisible|visible)$/ do |user, visibility| |
17 | - User.find_by_login(user).person.update_attributes(:visible => (visibility == 'visible')) | 17 | + User.find_by_login(user).person.update_attributes({:visible => (visibility == 'visible')}, :without_protection => true) |
18 | end | 18 | end |
19 | 19 | ||
20 | Given /^"(.+)" is (online|offline|busy) in chat$/ do |user, status| | 20 | Given /^"(.+)" is (online|offline|busy) in chat$/ do |user, status| |
@@ -30,7 +30,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | | @@ -30,7 +30,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | | ||
30 | category = row.delete("category") | 30 | category = row.delete("category") |
31 | img_name = row.delete("img") | 31 | img_name = row.delete("img") |
32 | city = row.delete("region") | 32 | city = row.delete("region") |
33 | - organization = klass.create!(row) | 33 | + organization = klass.create!(row, :without_protection => true) |
34 | if owner | 34 | if owner |
35 | organization.add_admin(Profile[owner]) | 35 | organization.add_admin(Profile[owner]) |
36 | end | 36 | end |
@@ -215,7 +215,7 @@ Given /^the following inputs?$/ do |table| | @@ -215,7 +215,7 @@ Given /^the following inputs?$/ do |table| | ||
215 | unit = Unit.find_by_singular(data.delete("unit")) | 215 | unit = Unit.find_by_singular(data.delete("unit")) |
216 | solidary = data.delete("solidary") | 216 | solidary = data.delete("solidary") |
217 | input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit, | 217 | input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit, |
218 | - :is_from_solidarity_economy => solidary)) | 218 | + :is_from_solidarity_economy => solidary), :without_protection => true) |
219 | input.update_attributes!(:position => data['position']) | 219 | input.update_attributes!(:position => data['position']) |
220 | end | 220 | end |
221 | end | 221 | end |
@@ -247,13 +247,13 @@ Given /^the following (product_categories|product_category|category|categories|r | @@ -247,13 +247,13 @@ Given /^the following (product_categories|product_category|category|categories|r | ||
247 | parent = Category.find_by_slug(parent.to_slug) | 247 | parent = Category.find_by_slug(parent.to_slug) |
248 | row.merge!({:parent_id => parent.id}) | 248 | row.merge!({:parent_id => parent.id}) |
249 | end | 249 | end |
250 | - category = klass.create!({:environment_id => Environment.default.id}.merge(row)) | 250 | + category = klass.create!({:environment => Environment.default}.merge(row)) |
251 | end | 251 | end |
252 | end | 252 | end |
253 | 253 | ||
254 | Given /^the following qualifiers$/ do |table| | 254 | Given /^the following qualifiers$/ do |table| |
255 | table.hashes.each do |row| | 255 | table.hashes.each do |row| |
256 | - Qualifier.create!(row.merge(:environment_id => 1)) | 256 | + Qualifier.create!(row.merge(:environment_id => 1), :without_protection => true) |
257 | end | 257 | end |
258 | end | 258 | end |
259 | 259 | ||
@@ -264,7 +264,7 @@ Given /^the following certifiers$/ do |table| | @@ -264,7 +264,7 @@ Given /^the following certifiers$/ do |table| | ||
264 | if qualifiers_list | 264 | if qualifiers_list |
265 | row["qualifiers"] = qualifiers_list.split(', ').map{|i| Qualifier.find_by_name(i)} | 265 | row["qualifiers"] = qualifiers_list.split(', ').map{|i| Qualifier.find_by_name(i)} |
266 | end | 266 | end |
267 | - Certifier.create!(row.merge(:environment_id => 1)) | 267 | + Certifier.create!(row.merge(:environment_id => 1), :without_protection => true) |
268 | end | 268 | end |
269 | end | 269 | end |
270 | 270 | ||
@@ -285,18 +285,18 @@ Given /^the following price details?$/ do |table| | @@ -285,18 +285,18 @@ Given /^the following price details?$/ do |table| | ||
285 | end | 285 | end |
286 | 286 | ||
287 | Given /^I am logged in as "(.+)"$/ do |username| | 287 | Given /^I am logged in as "(.+)"$/ do |username| |
288 | - Given %{I go to logout page} | ||
289 | - And %{I go to login page} | ||
290 | - And %{I fill in "main_user_login" with "#{username}"} | ||
291 | - And %{I fill in "user_password" with "123456"} | ||
292 | - When %{I press "Log in"} | 288 | + step %{I go to logout page} |
289 | + step %{I go to login page} | ||
290 | + step %{I fill in "main_user_login" with "#{username}"} | ||
291 | + step %{I fill in "user_password" with "123456"} | ||
292 | + step %{I press "Log in"} | ||
293 | # FIXME: | 293 | # FIXME: |
294 | # deveria apenas verificar que esta no myprofile do usuario | 294 | # deveria apenas verificar que esta no myprofile do usuario |
295 | # nao conseguir fazer funcionar sem essa reduntancia no capybara | 295 | # nao conseguir fazer funcionar sem essa reduntancia no capybara |
296 | # acho que e algum problema com o http_referer | 296 | # acho que e algum problema com o http_referer |
297 | # olhar account_controller#store_location | 297 | # olhar account_controller#store_location |
298 | - And %{I go to #{username}'s control panel} | ||
299 | - Then %{I should be on #{username}'s control panel} | 298 | + step %{I go to #{username}'s control panel} |
299 | + step %{I should be on #{username}'s control panel} | ||
300 | end | 300 | end |
301 | 301 | ||
302 | Given /^"([^"]*)" is environment admin$/ do |person| | 302 | Given /^"([^"]*)" is environment admin$/ do |person| |
@@ -512,7 +512,7 @@ end | @@ -512,7 +512,7 @@ end | ||
512 | 512 | ||
513 | Given /^the following units?$/ do |table| | 513 | Given /^the following units?$/ do |table| |
514 | table.hashes.each do |row| | 514 | table.hashes.each do |row| |
515 | - Unit.create!(row.merge(:environment_id => 1)) | 515 | + Unit.create!(row.merge(:environment_id => 1), :without_protection => true) |
516 | end | 516 | end |
517 | end | 517 | end |
518 | 518 | ||
@@ -640,9 +640,9 @@ Given /^the following tags$/ do |table| | @@ -640,9 +640,9 @@ Given /^the following tags$/ do |table| | ||
640 | end | 640 | end |
641 | 641 | ||
642 | When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query| | 642 | When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query| |
643 | - When %{I go to the search #{asset} page} | ||
644 | - And %{I fill in "search-input" with "#{query}"} | ||
645 | - And %{I press "Search"} | 643 | + step %{I go to the search #{asset} page} |
644 | + step %{I fill in "search-input" with "#{query}"} | ||
645 | + step %{I press "Search"} | ||
646 | end | 646 | end |
647 | 647 | ||
648 | Then /^I should see ([^\"]*)'s product image$/ do |product_name| | 648 | Then /^I should see ([^\"]*)'s product image$/ do |product_name| |
features/step_definitions/web_steps.rb
@@ -11,7 +11,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "pat | @@ -11,7 +11,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "pat | ||
11 | 11 | ||
12 | module WithinHelpers | 12 | module WithinHelpers |
13 | def with_scope(locator) | 13 | def with_scope(locator) |
14 | - locator ? within(locator) { yield } : yield | 14 | + locator ? first(locator) { yield } : yield |
15 | end | 15 | end |
16 | end | 16 | end |
17 | World(WithinHelpers) | 17 | World(WithinHelpers) |
@@ -26,13 +26,13 @@ end | @@ -26,13 +26,13 @@ end | ||
26 | 26 | ||
27 | When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector| | 27 | When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector| |
28 | with_scope(selector) do | 28 | with_scope(selector) do |
29 | - click_button(button) | 29 | + first(:button, button).click |
30 | end | 30 | end |
31 | end | 31 | end |
32 | 32 | ||
33 | When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| | 33 | When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| |
34 | with_scope(selector) do | 34 | with_scope(selector) do |
35 | - click_link(link) | 35 | + first(:link, link).click |
36 | end | 36 | end |
37 | end | 37 | end |
38 | 38 | ||
@@ -62,7 +62,7 @@ end | @@ -62,7 +62,7 @@ end | ||
62 | When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields| | 62 | When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields| |
63 | with_scope(selector) do | 63 | with_scope(selector) do |
64 | fields.rows_hash.each do |name, value| | 64 | fields.rows_hash.each do |name, value| |
65 | - When %{I fill in "#{name}" with "#{value}"} | 65 | + step %{I fill in "#{name}" with "#{value}"} |
66 | end | 66 | end |
67 | end | 67 | end |
68 | end | 68 | end |