>
- <% if @page.allow_post_content?(user) || @page.allow_publish_content?(user) %>
-
-
+
<% if !@page.tags.empty? %>
- <% if @page.allow_post_content?(user) %>
- <%= link_to content_tag( 'span', label_for_edit_article(@page) ),
- profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }),
- :class => 'button with-text icon-edit' %>
- <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %>
- <% if @page != profile.home_page && !@page.has_posts? %>
- <%= link_to content_tag( 'span', _('Delete') ),
- profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page }),
- :class => 'button with-text icon-delete' %>
- <% end %>
- <% if !environment.enabled?('disable_cms') && !@page.folder? %>
- <% if profile.kind_of?(Person) %>
- <%= link_to content_tag( 'span', _('Spread this') ),
- profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }),
- :class => 'button with-text icon-spread' %>
- <% elsif profile.kind_of?(Community) && environment.portal_community %>
- <%= link_to content_tag( 'span', _('Spread this') ),
- profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }),
- :class => 'button with-text icon-spread' %>
- <% end %>
- <% end %>
- <% end %>
- <% end %>
- <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %>
- <% if !@page.gallery? %>
- <%= link_to _('Add translation'),
- profile.admin_url.merge(:controller => 'cms', :action => 'new',
- :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)),
- :type => @page.type, :article => { :translation_of_id => @page.native_translation.id }),
- :class => 'button with-text icon-locale' if @page.translatable? && !@page.native_translation.language.blank? %>
- <%= lightbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %>
- <% end %>
- <% if (@page.folder? && !@page.has_posts?) || (@page.parent && @page.parent.folder? && !@page.parent.has_posts?) %>
- <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %>
- <% end %>
- <% end %>
- <% if profile.kind_of?(Enterprise) && @page.gallery? %>
- <%= button('upload-file', _('Upload files'), :controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent)) %>
- <% end %>
-
- <% elsif profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) %>
-
- <%= link_to content_tag( 'span', _('Suggest an article') ), profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}), :id => 'suggest-article-link', :class => 'button with-text icon-new' %>
-
- <% end %>
-
- <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
- <%= article_title(@page, :no_link => true) %>
- <%= article_translations(@page) %>
-
-
diff --git a/app/views/profile/profile_info.rjs b/app/views/profile/profile_info.rjs
new file mode 100644
index 0000000..e39b3e3
--- /dev/null
+++ b/app/views/profile/profile_info.rjs
@@ -0,0 +1,6 @@
+if !user.nil? and user.has_permission?('edit_profile', profile)
+ page.replace_html "profile-admin-url-#{@block.id}", link_to(_('Control panel'), @block.owner.admin_url)
+else
+ page.hide "profile-admin-url-#{@block.id}"
+end
+page.replace_html "profile-info-options-#{@block.id}", :file => 'blocks/profile_info_actions/' + @block.owner.class.name.underscore
diff --git a/features/activate_enterprise.feature b/features/activate_enterprise.feature
index 69dbdac..d3842d2 100644
--- a/features/activate_enterprise.feature
+++ b/features/activate_enterprise.feature
@@ -7,10 +7,10 @@ Feature: activate enterprise
Given the following users
| login | name |
| joaosilva | Joao Silva |
+ And I am logged in as "joaosilva"
Scenario: added an unexistent code
Given feature "enterprise_activation" is enabled on environment
- And I am logged in as "joaosilva"
And I am on Joao Silva's control panel
And I fill in "Enterprise activation code" with "abcde"
When I press "Activate"
@@ -21,7 +21,6 @@ Feature: activate enterprise
And the following enterprises
| identifier | name | enabled |
| products-factory | Products Factory | false |
- And I am logged in as "joaosilva"
And I am on Joao Silva's control panel
And enterprise "Products Factory" is enabled
And I fill in "Enterprise activation code" with code of "Products Factory"
@@ -33,7 +32,6 @@ Feature: activate enterprise
And the following enterprises
| identifier | name | enabled |
| products-factory | Products Factory | false |
- And I am logged in as "joaosilva"
And I am on Joao Silva's control panel
And I fill in "Enterprise activation code" with code of "Products Factory"
When I press "Activate"
@@ -45,7 +43,6 @@ Feature: activate enterprise
And the following enterprises
| identifier | name | enabled | foundation_year |
| services-provider | Services Provider | false | 2000 |
- And I am logged in as "joaosilva"
And I am on Joao Silva's control panel
And I fill in "Enterprise activation code" with code of "Services Provider"
And I press "Activate"
@@ -59,7 +56,6 @@ Feature: activate enterprise
And the following enterprises
| identifier | name | enabled | cnpj |
| services-provider | Services Provider | false | 00000000000000 |
- And I am logged in as "joaosilva"
And I am on Joao Silva's control panel
And I fill in "Enterprise activation code" with code of "Services Provider"
And I press "Activate"
@@ -74,11 +70,10 @@ Feature: activate enterprise
And the following enterprises
| identifier | name | enabled | foundation_year |
| services-provider | Services Provider | false | 2000 |
- And I am logged in as "joaosilva"
- And I am on Joao Silva's control panel
+ And I visit "Joao Silva's control panel" and wait
And I fill in "Enterprise activation code" with code of "Services Provider"
- And I press "Activate"
- And I fill in "enterprise-activation-answer" with "2000"
+ And I press "Activate" and wait
+ And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000"
And I press "Continue"
And I check "I read the terms of use and accepted them"
When I press "Continue"
@@ -92,22 +87,21 @@ Feature: activate enterprise
And feature "enterprise_activation" is enabled on environment
And the following enterprises
| identifier | name | enabled | foundation_year |
- | services-provider | Services Provider | false | 2000 |
+ | services-provider-2 | Services Provider 2 | false | 2000 |
| active-template | Active Template | false | 2000 |
And "Active Template" is the active enterprise template
- And "Services Provider" doesnt have "Active Template" as template
- And I am logged in as "joaosilva"
- And I am on Joao Silva's control panel
- And I fill in "Enterprise activation code" with code of "Services Provider"
- And I press "Activate"
- And I fill in "enterprise-activation-answer" with "2000"
+ And "Services Provider 2" doesnt have "Active Template" as template
+ And I visit "Joao Silva's control panel" and wait
+ And I fill in "Enterprise activation code" with code of "Services Provider 2"
+ And I press "Activate" and wait
+ And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000"
And I press "Continue"
And I check "I read the terms of use and accepted them"
When I press "Continue"
- Then I should see "Services Provider was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise"
- And enterprise "Services Provider" should be enabled
- And "Joao Silva" is admin of "Services Provider"
- And "Services Provider" has "Active Template" as template
+ Then I should see "Services Provider 2 was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise"
+ And enterprise "Services Provider 2" should be enabled
+ And "Joao Silva" is admin of "Services Provider 2"
+ And "Services Provider 2" has "Active Template" as template
@selenium
Scenario: not replace template after enable an enterprise
@@ -115,20 +109,18 @@ Feature: activate enterprise
And feature "enterprise_activation" is enabled on environment
And the following enterprises
| identifier | name | enabled | foundation_year |
- | services-provider | Services Provider | false | 2000 |
+ | services-provider-3 | Services Provider 3 | false | 2000 |
| active-template | Active Template | false | 2000 |
And "Active Template" is the active enterprise template
- And "Services Provider" doesnt have "Active Template" as template
- And I am logged in as "joaosilva"
- And I am on Joao Silva's control panel
- And I fill in "Enterprise activation code" with code of "Services Provider"
- And I press "Activate"
- And I fill in "enterprise-activation-answer" with "2000"
+ And "Services Provider 3" doesnt have "Active Template" as template
+ When I visit "Joao Silva's control panel" and wait
+ And I fill in "Enterprise activation code" with code of "Services Provider 3"
+ And I press "Activate" and wait
+ And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000"
And I press "Continue"
And I check "I read the terms of use and accepted them"
When I press "Continue"
- Then I should see "Services Provider was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise"
- And enterprise "Services Provider" should be enabled
- And "Joao Silva" is admin of "Services Provider"
- And "Services Provider" doesnt have "Active Template" as template
-
+ Then I should see "Services Provider 3 was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise"
+ And enterprise "Services Provider 3" should be enabled
+ And "Joao Silva" is admin of "Services Provider 3"
+ And "Services Provider 3" doesnt have "Active Template" as template
diff --git a/features/admin_categories.feature b/features/admin_categories.feature
index e098ce8..7b18e01 100644
--- a/features/admin_categories.feature
+++ b/features/admin_categories.feature
@@ -14,10 +14,15 @@ Feature: manage categories
Given I am logged in as admin
@selenium
- Scenario: admin user could create a category
+ Scenario: admin user could access new category
Given I follow "Administration"
- And I follow "Manage Categories"
- And I follow "New category"
+ When I follow "Manage Categories"
+ And I follow "New category" and wait
+ Then I should be on /admin/categories/new
+
+ @selenium
+ Scenario: admin user could create a category
+ Given I visit "/admin/categories/new" and wait
When I fill in "Name" with "Category 1"
And I press "Save"
Then I should see "Categories"
@@ -47,7 +52,8 @@ Feature: manage categories
Given the following category
| parent | name | display_in_menu |
| Steak | Pig | true |
- And I follow "Administration"
+ And I am on the homepage
+ When I follow "Administration"
And I follow "Manage Categories"
Then I should see "Food Show"
When I follow "Show"
diff --git a/features/approve_article.feature b/features/approve_article.feature
index 80c75b8..44d4665 100644
--- a/features/approve_article.feature
+++ b/features/approve_article.feature
@@ -18,18 +18,19 @@ Feature: approve article
And "Maria Silva" is a member of "Sample Community"
And "Joao Silva" is admin of "Sample Community"
+ @selenium
Scenario: edit an article before approval
Given I am logged in as "mariasilva"
And I am on Maria Silva's homepage
- And I follow "Spread"
+ When I follow "Spread" and wait
And I check "Sample Community"
And I press "Spread this"
- When I am logged in as "joaosilva"
+ And I am logged in as "joaosilva"
And I go to Sample Community's control panel
- And I follow "Process requests"
+ And I follow "Process requests" and wait
And I fill in "Text" with "This is an article edited"
And I choose "Accept"
And I press "Apply!"
And I go to Sample Community's sitemap
- When I follow "Sample Article"
+ And I follow "Sample Article"
Then I should see "This is an article edited"
diff --git a/features/balloon.feature b/features/balloon.feature
index 2a0aea7..b17f905 100644
--- a/features/balloon.feature
+++ b/features/balloon.feature
@@ -2,22 +2,18 @@ Feature: balloon
I want to view a balloon when mouse clicks on profile trigger
Background:
- Given I am on the homepage
Given the following users
- | login | name |
+ | login | name |
| joaosilva | Joao Silva |
And the following communities
- | identifier | name |
- | sample | Sample |
+ | identifier | name |
+ | sample | Sample |
@selenium
Scenario: I should not see trigger if not enabled
- Given the following blocks
- | owner | type |
- | environment | PeopleBlock |
- And feature "show_balloon_with_profile_links_when_clicked" is disabled on environment
- And I go to the homepage
- Then I should not see "Friends"
+ Given feature "show_balloon_with_profile_links_when_clicked" is disabled on environment
+ When I go to /browse/people
+ Then I should not see "Profile links"
@selenium
Scenario: I should not see trigger by default
@@ -25,7 +21,7 @@ Feature: balloon
| owner | type |
| environment | PeopleBlock |
And feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
- And I go to the homepage
+ When I go to the homepage
Then I should not see "Friends"
@selenium
@@ -34,39 +30,33 @@ Feature: balloon
| owner | type |
| environment | PeopleBlock |
And feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
- And I go to the homepage
- When I click ".menu-submenu-trigger"
- Then I should see "Profile"
- And I should see "Friends"
+ When I go to the homepage
+ And I follow "Profile links"
+ Then I should see "Friends"
@selenium
Scenario: I should see balloon when clicked on community block trigger
- Given the following blocks
- | owner | type |
- | environment | CommunitiesBlock |
- And feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
- And I go to the homepage
- When I click ".menu-submenu-trigger"
- Then I should see "Profile"
- And I should see "Members"
- And I should see "Agenda"
+ Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
+ When I go to /browse/communities
+ And I follow "Profile links"
+ Then I should see "Members"
@selenium
Scenario: I should not see trigger if not enabled on page
Given feature "show_balloon_with_profile_links_when_clicked" is disabled on environment
- And I go to /assets/communities
- Then I should not see "Members"
+ When I go to /assets/people
+ Then I should not see "Profile links"
@selenium
Scenario: I should not see trigger by default on page
Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
- And I go to /assets/communities
+ When I go to /assets/communities
Then I should not see "Members"
@selenium
Scenario: I should see balloon when clicked on page trigger
Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
- And I go to /assets/communities
- When I click ".menu-submenu-trigger"
+ When I go to /assets/communities
+ And I follow "Profile links"
Then I should see "Members"
And I should see "Agenda"
diff --git a/features/blog.feature b/features/blog.feature
index 07f877c..26b3b0e 100644
--- a/features/blog.feature
+++ b/features/blog.feature
@@ -83,12 +83,13 @@ Feature: blog
When I follow "Configure blog"
Then I should be on edit "Blog One" by joaosilva
+ @selenium
Scenario: configure blog when viewing it
Given the following blogs
| owner | name |
| joaosilva | Blog One |
And I go to /joaosilva/blog-one
- When I follow "Configure blog"
+ When I follow "Configure blog" and wait
Then I should be on edit "Blog One" by joaosilva
Scenario: change address of blog
diff --git a/features/browse.feature b/features/browse.feature
index 672f324..77a0060 100644
--- a/features/browse.feature
+++ b/features/browse.feature
@@ -39,10 +39,9 @@ Feature: browse
And I should see "Invite friends"
And I should see "My friends"
- @selenium
Scenario: Browse people by query
Given I go to /browse/people
- When I fill in "query" with "Silva"
+ When I fill in "Silva" for "query"
And I press "Search"
Then I should see "Joao Silva"
And I should see "Pedro Silva"
@@ -53,8 +52,8 @@ Feature: browse
@selenium
Scenario: Communities browse menu should add logged information
Given I am logged in as "joaosilva"
- And I am on the homepage
- And I should not see "More Recent"
+ When I go to /joaosilva
+ Then I should not see "More Recent"
And I should not see "More Active"
And I should not see "More Popular"
And I should not see "My communities"
@@ -76,14 +75,12 @@ Feature: browse
And I should see "More Active"
And I should see "More Popular"
- @selenium
Scenario: Browse communities by query
- Given I go to /browse/communities
- When I fill in "query" with "Silva"
+ When I go to /browse/communities
+ And I fill in "Silva" for "query"
And I press "Search"
Then I should see "Community Silva"
And I should not see "Joao Silva"
And I should not see "Pedro Silva"
And I should not see "Paulo Neto"
And I should not see "Community Neto"
-
diff --git a/features/categories_block.feature b/features/categories_block.feature
index 98ea287..2749650 100644
--- a/features/categories_block.feature
+++ b/features/categories_block.feature
@@ -61,12 +61,10 @@ Feature: categories_block
And I follow "Edit" within ".categories-block"
And I check "Product"
And I press "Save"
- Then I should see "Food"
- And I should not see "Vegetarian"
- And I should not see "Steak"
+ Then I should see "Book"
+ And I should not see "Literature"
When I click ".category-link-expand category-root"
- Then I should see "Vegetarian"
- And I should see "Steak"
+ Then I should see "Literature"
@selenium
Scenario: List just general categories
diff --git a/features/chat.feature b/features/chat.feature
index b9e13e0..412e360 100644
--- a/features/chat.feature
+++ b/features/chat.feature
@@ -43,6 +43,7 @@ Feature: chat
Given I am on Tame's homepage
Then I should not see "Open chat" link
+ @selenium
Scenario: not provide the chat online users list when environment not support that
Given I am logged in as "tame"
Then I should not see "Online friends "
@@ -98,6 +99,7 @@ Feature: chat
And the "#chat-busy" should be visible
And the "#chat-disconnect" should be visible
+ @selenium
Scenario: link to open chatroom of a community
Given the following communities
| identifier | name |
@@ -108,6 +110,7 @@ Feature: chat
When I go to Autoramas's profile
Then I should see "Enter chat room" link
+ @selenium
Scenario: not see link to open chatroom of a community if not a member
Given the following communities
| identifier | name |
@@ -117,6 +120,7 @@ Feature: chat
When I go to Autoramas's profile
Then I should not see "Enter chat room" link
+ @selenium
Scenario: not see link to open chatroom of a community if xmpp_chat disabled
Given the following communities
| identifier | name |
diff --git a/features/comment.feature b/features/comment.feature
index fdb0a84..4c24e8b 100644
--- a/features/comment.feature
+++ b/features/comment.feature
@@ -18,7 +18,7 @@ Feature: comment
Scenario: not post a comment without javascript
Given I am on /booking/article-to-comment
And I fill in "Name" with "Joey Ramone"
- And I fill in "e-Mail" with "joey@ramones.com"
+ And I fill in "e-mail" with "joey@ramones.com"
And I fill in "Title" with "Hey ho, let's go!"
And I fill in "Enter your comment" with "Hey ho, let's go!"
When I press "Post comment"
@@ -28,7 +28,7 @@ Feature: comment
Scenario: post a comment while not authenticated
Given I am on /booking/article-to-comment
And I fill in "Name" with "Joey Ramone"
- And I fill in "e-Mail" with "joey@ramones.com"
+ And I fill in "e-mail" with "joey@ramones.com"
And I fill in "Title" with "Hey ho, let's go!"
And I fill in "Enter your comment" with "Hey ho, let's go!"
When I press "Post comment"
@@ -67,7 +67,7 @@ Feature: comment
Scenario: disable post comment button
Given I am on /booking/article-to-comment
And I fill in "Name" with "Joey Ramone"
- And I fill in "e-Mail" with "joey@ramones.com"
+ And I fill in "e-mail" with "joey@ramones.com"
And I fill in "Title" with "Hey ho, let's go!"
And I fill in "Enter your comment" with "Hey ho, let's go!"
When I press "Post comment"
diff --git a/features/contact.feature b/features/contact.feature
index b680d6c..50fbf5c 100644
--- a/features/contact.feature
+++ b/features/contact.feature
@@ -12,16 +12,18 @@ In order to ask questions and solve problems
| sample-community | Sample Community |
And I am logged in as "joaosilva"
+ @selenium
Scenario: without states
Given I am on Sample Community's homepage
- When I follow "Send an e-mail"
+ When I follow "Send an e-mail" and wait
Then I should not see "City and state"
+ @selenium
Scenario: with states
Given the following states
| name |
| Bahia |
And I am on Sample Community's homepage
- When I follow "Send an e-mail"
+ When I follow "Send an e-mail" and wait
Then I should see "City and state"
diff --git a/features/edit_article.feature b/features/edit_article.feature
index a882de1..b80bf05 100644
--- a/features/edit_article.feature
+++ b/features/edit_article.feature
@@ -77,52 +77,57 @@ Feature: edit article
Then I should see "My Article"
And I should be on /joaosilva/my-article
+ @selenium
Scenario: edit an article
Given I am on Joao Silva's sitemap
- And I follow "Save the whales"
- And I follow "Edit"
+ When I follow "Save the whales" and wait
+ And I follow "Edit" and wait
And I fill in "Title" with "My Article edited"
- When I press "Save"
+ And I press "Save" and wait
Then I should be on /joaosilva/my-article-edited
+ @selenium
Scenario: cancel button back to article when edit
Given I am on Joao Silva's sitemap
- And I follow "Save the whales"
- And I follow "Edit"
- When I follow "Cancel" within ".main-block"
+ When I follow "Save the whales" and wait
+ And I follow "Edit" and wait
+ And I follow "Cancel" within ".main-block" and wait
Then I should be on /joaosilva/save-the-whales
+ @selenium
Scenario: create an article inside a folder
Given I am on Joao Silva's control panel
- And I follow "Manage Content"
+ When I follow "Manage Content"
And I follow "New content"
- And I follow "Folder"
+ And I follow "Folder" and wait
And I fill in "Title" with "My Folder"
- And I press "Save"
+ And I press "Save" and wait
Then I should be on /joaosilva/my-folder
When I follow "New article"
- And I follow "Text article with visual editor"
+ And I follow "Text article with visual editor" and wait
And I fill in "Title" with "My Article"
- And I press "Save"
+ And I press "Save" and wait
Then I should see "My Article"
And I should be on /joaosilva/my-folder/my-article
+ @selenium
Scenario: cancel button back to folder after giving up creating
Given I am on Joao Silva's control panel
- And I follow "Manage Content"
+ When I follow "Manage Content"
And I follow "New content"
- And I follow "Folder"
+ And I follow "Folder" and wait
And I fill in "Title" with "My Folder"
- And I press "Save"
+ And I press "Save" and wait
Then I should be on /joaosilva/my-folder
When I follow "New article"
- And I follow "Text article with visual editor"
- When I follow "Cancel" within ".no-boxes"
- And I should be on /joaosilva/my-folder
+ And I follow "Text article with visual editor" and wait
+ And I follow "Cancel" within ".no-boxes" and wait
+ Then I should be on /joaosilva/my-folder
+ @selenium
Scenario: save and continue
Given I am on /joaosilva/save-the-whales
- And I follow "Edit"
+ And I follow "Edit" and wait
When I fill in "Text" with "new text"
And I press "Save and continue"
Then the "Text" field should contain "new text"
@@ -140,31 +145,33 @@ Feature: edit article
And the "Title" field should contain "My new article"
And the "Text" field should contain "text for the new article"
+ @selenium
Scenario: add a translation to an article
Given I am on Joao Silva's sitemap
And I follow "Save the whales"
Then I should not see "Add translation"
- And I follow "Edit"
+ And I follow "Edit" and wait
And I select "English" from "Language"
- Then I press "Save"
- And I follow "Add translation"
+ Then I press "Save" and wait
+ And I follow "Add translation" and wait
And I fill in "Title" with "Mi neuvo artículo"
And I select "Español" from "Language"
- When I press "Save"
+ When I press "Save" and wait
Then I should be on /joaosilva/mi-neuvo-articulo
And I should see "Translations"
+ @selenium
Scenario: not add a translation without a language
Given the following articles
| owner | name | language |
| joaosilva | Article in English | en |
And I am on Joao Silva's sitemap
- And I follow "Article in English"
- And I follow "Add translation"
+ When I follow "Article in English" and wait
+ And I follow "Add translation" and wait
And I fill in "Title" with "Article in Portuguese"
- When I press "Save"
+ And I press "Save" and wait
Then I should see "Language must be choosen"
- And I select "Português" from "Language"
- When I press "Save"
+ When I select "Português" from "Language"
+ And I press "Save" and wait
Then I should not see "Language must be choosen"
And I should be on /joaosilva/article-in-portuguese
diff --git a/features/edit_block_of_links.feature b/features/edit_block_of_links.feature
index 45ad7c9..581af26 100644
--- a/features/edit_block_of_links.feature
+++ b/features/edit_block_of_links.feature
@@ -14,9 +14,9 @@ Feature: edit_block_of_links
@selenium
Scenario: show the icon selector
- And I follow "Edit sideboxes"
- Given I follow "Edit" within ".link-list-block"
- And I follow "New link"
- And the ".icon-selector" should not be visible
+ Given I follow "Edit sideboxes"
+ And I follow "Edit" within ".link-list-block"
+ When I follow "New link"
+ Then the "css=div.icon-selector" should not be visible
When I click ".icon"
- Then the ".icon-selector" should be visible
+ Then the "css=div.icon-selector" should be visible
diff --git a/features/events.feature b/features/events.feature
index b41d039..c662812 100644
--- a/features/events.feature
+++ b/features/events.feature
@@ -175,15 +175,16 @@ Feature: events
When I am on /assets/events
Then I should see "Colivre.net's events"
+ @selenium
Scenario: published events should be listed in the agenda too
Given the following community
| identifier | name |
| sample-community | Sample Community |
And I am logged in as "josesilva"
And "josesilva" is a member of "Sample Community"
- And I am on josesilva's control panel
- And I follow "Manage content"
- And I follow "Another Conference"
+ And I go to josesilva's control panel
+ And I follow "Manage Content"
+ And I follow "Another Conference" and wait
And I follow "Spread"
And I check "Sample Community"
And I press "Spread this"
@@ -212,19 +213,18 @@ Feature: events
And I am on josesilva's Event creation
Then I should see "Lead"
+ @selenium
Scenario: events lead should be shown on blogs with short format
Given I am logged in as "josesilva"
And I am on josesilva's control panel
- And I follow "Configure blog"
+ And I follow "Configure blog" and wait
And I select "First paragraph" from "How to display posts:"
And I press "Save"
And I follow "New post"
- And I follow "Event"
- And I follow "Lead"
- And I fill in the following:
- | Title | Leaded event |
- | Information about the event | This is the real text.|
- | Lead | This is the abstract. |
+ And I follow "A calendar event" and wait
+ And I fill in "Title" with "Leaded event"
+ And I type "This is the abstract." in TinyMCE field "article_abstract"
+ And I type "This is the real text." in TinyMCE field "article_body"
And I press "Save"
When I am on josesilva's blog
Then I should see "Leaded event"
diff --git a/features/forum.feature b/features/forum.feature
index 4506669..c25f79f 100644
--- a/features/forum.feature
+++ b/features/forum.feature
@@ -10,13 +10,14 @@ Feature: forum
And "joaosilva" has no articles
And I am logged in as "joaosilva"
+ @selenium
Scenario: create a forum
- Given I go to the Control panel
+ Given I am on Joao Silva's control panel
And I follow "Manage Content"
And I follow "New content"
- When I follow "Forum"
+ When I follow "Forum" and wait
And I fill in "Title" with "My Forum"
- And I press "Save"
+ And I press "Save" and wait
Then I should see "Configure forum"
Scenario: redirect to forum after create forum from cms
@@ -60,12 +61,13 @@ Feature: forum
When I follow "Cancel" within ".main-block"
Then I should be on /myprofile/joaosilva/cms
+ @selenium
Scenario: configure forum when viewing it
Given the following forums
- | owner | name |
+ | owner | name |
| joaosilva | Forum One |
- And I go to /joaosilva/forum-one
- When I follow "Configure forum"
+ And I visit "/joaosilva/forum-one" and wait
+ When I follow "Configure forum" and wait
Then I should be on edit "Forum One" by joaosilva
Scenario: last topic update by unautenticated user should not link
diff --git a/features/gallery_navigation.feature b/features/gallery_navigation.feature
index 77a008e..63e3ee9 100644
--- a/features/gallery_navigation.feature
+++ b/features/gallery_navigation.feature
@@ -7,20 +7,23 @@ Feature: gallery_navigation
| login |
| marciopunk |
And the following galleries
- | owner | name |
- | marciopunk | my-gallery |
+ | owner | name |
+ | marciopunk | my-gallery |
+ | marciopunk | other-gallery |
And the following files
- | owner | file | mime | parent |
- | marciopunk | rails.png | image/png | my-gallery |
- | marciopunk | other-pic.jpg | image/jpeg | my-gallery |
+ | owner | file | mime | parent |
+ | marciopunk | rails.png | image/png | my-gallery |
+ | marciopunk | rails.png | image/png | other-gallery |
+ | marciopunk | other-pic.jpg | image/jpeg | my-gallery |
Scenario: provide link to go to next image
Given I am on /marciopunk/my-gallery/other-pic.jpg?view=true
Then I should see "Next »"
+ @selenium
Scenario: view next image when follow next link
Given I am on /marciopunk/my-gallery/other-pic.jpg?view=true
- When I follow "Next »"
+ When I follow "Next »" and wait
Then I should see "rails.png" within ".title"
Scenario: not link to next when in last image
@@ -32,9 +35,10 @@ Feature: gallery_navigation
Given I am on /marciopunk/my-gallery/other-pic.jpg?view=true
Then I should see "« Previous"
+ @selenium
Scenario: view previous image when follow previous link
Given I am on /marciopunk/my-gallery/rails.png?view=true
- When I follow "« Previous"
+ When I follow "« Previous" and wait
Then I should see "other-pic.jpg" within ".title"
Scenario: not link to previous when in first image
@@ -64,11 +68,11 @@ Feature: gallery_navigation
When I follow "Go back to my-gallery"
Then I should be on /marciopunk/my-gallery
+ @selenium
Scenario: image title in window title
Given I am logged in as "marciopunk"
- And I go to /marciopunk/my-gallery/rails.png?view=true
- When I follow "Edit"
+ When I visit "/marciopunk/other-gallery/rails.png?view=true" and wait
+ And I follow "Edit" and wait
And I fill in "Title" with "Rails is cool"
- And I press "Save"
- And I go to /marciopunk/my-gallery/rails.png?view=true
- And The page title should contain "Rails is cool"
+ And I press "Save" and wait
+ Then The page title should contain "Rails is cool"
diff --git a/features/manage_inputs.feature b/features/manage_inputs.feature
index 070e025..78bced3 100644
--- a/features/manage_inputs.feature
+++ b/features/manage_inputs.feature
@@ -57,8 +57,8 @@ Feature: manage inputs
Given I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
- And I follow "Add the inputs or raw material used by this product"
- When I follow "Cancel"
+ And I follow "Add the inputs or raw material used by this product" and wait until "#input-category-form" is present
+ And I click "css=a.cancel-add-input"
Then I should see "Abbey Road"
And I should see "Add the inputs or raw material used by this product"
@@ -182,12 +182,12 @@ Feature: manage inputs
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Abbey Road
And I follow "Inputs"
- And I follow "Click here to add price and the amount used"
+ And I follow "Click here to add price and the amount used" and wait until ".input-details-form" is present
Then I should see "Cancel"
And I should see "Amount used"
And I should see "Price"
And I should see "This input or raw material inpact on the final price of the product?"
- When I follow "Cancel"
+ When I click "css=a.cancel-edit-input"
Then I should see "Click here to add price and the amount used"
@selenium
@@ -215,6 +215,7 @@ Feature: manage inputs
Then I should see "Rock"
And I should not see "Add the inputs or raw material used by this product"
When I follow "Remove"
+ And I confirm
Then I should see "Add the inputs or raw material used by this product"
@selenium
diff --git a/features/manage_products.feature b/features/manage_products.feature
index 575ccf4..58a8b7a 100644
--- a/features/manage_products.feature
+++ b/features/manage_products.feature
@@ -133,7 +133,7 @@ Feature: manage products
And I am on Rede Moinho's control panel
And I follow "Manage Products and Services"
When I follow "New product or service"
- And I select "Toplevel Product ... »" and wait for jquery
+ And I select "Toplevel Product Categories »" and wait for jquery
And I select "Category Level 1" and wait for jquery
Then I should see "Toplevel Product Categories" link
And I should not see "Category Level 1" link
@@ -149,14 +149,14 @@ Feature: manage products
@selenium
Scenario: enable save button when select one category
- Given the following product_category
+ Given I am logged in as "joaosilva"
+ And the following product_category
| name |
| Browsers (accept categories) |
- Given I am logged in as "joaosilva"
And I am on Rede Moinho's control panel
And I follow "Manage Products and Services"
When I follow "New product or service"
- And I select "Browsers (accept ..." and wait for jquery
+ And I select "Browsers (accept categories)" and wait for jquery
Then the "Save and continue" button should be enabled
@selenium
@@ -290,7 +290,7 @@ Feature: manage products
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Bike
And I follow "Edit name"
- And I fill in "product_name" with "Red bicycle"
+ And I fill in "Red bicycle" for "product_name"
And I press "Save"
Then I should see "Red bicycle"
And I should be on Rede Moinho's page of product Red bicycle
@@ -453,7 +453,7 @@ Feature: manage products
| Nanonote nanotech with long long name |
And the following product_category
| name | parent |
- | Netbook Quantum | Super Quantum Computers |
+ | Netbook Quantum | Super Quantum Computers with teraflops |
And I am logged in as "joaosilva"
When I go to Rede Moinho's new product page
Then I should see "Nanonote nanotech with long lo..."
@@ -473,7 +473,7 @@ Feature: manage products
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Bike
And I follow "Edit name and unit"
- And I fill in "product_name" with "Red bicycle"
+ And I fill in "Red bicycle" for "product_name"
And I select "Kilo"
And I press "Save"
Then I should see "Red bicycle - kilo"
@@ -489,7 +489,7 @@ Feature: manage products
And I am logged in as "joaosilva"
When I go to Rede Moinho's page of product Bike
And I follow "Add price and other basic information"
- And I fill in "product_price" with "10"
+ And I fill in "10" for "product_price"
And I choose "No"
And I press "Save"
Then I should see "Product not available!"
diff --git a/features/my_network_block.feature b/features/my_network_block.feature
index 09c8e81..f9e1d16 100644
--- a/features/my_network_block.feature
+++ b/features/my_network_block.feature
@@ -13,30 +13,32 @@ Feature: my_network_block
| identifier | name | public_profile |
| public-community | Public Community | true |
+ @selenium
Scenario: display how many public/private communities I am member
- Given the following communities
+ Given I am logged in as "joaosilva"
+ And the following communities
| identifier | name | owner | public_profile |
| other-public-community | Other Public Community | joaosilva | true |
| private-community | Private Community | joaosilva | false |
- And I am logged in as "joaosilva"
And I am on Joao Silva's homepage
- Then I should see "2 communities"
+ And I should see "2 communities"
When I go to Public Community's homepage
And I follow "Join"
- When I go to Joao Silva's homepage
+ And I go to Joao Silva's homepage
Then I should see "3 communities"
+ @selenium
Scenario: not display how many invisible communities I am member
- Given the following communities
+ Given I am logged in as "joaosilva"
+ And the following communities
| identifier | name | owner | visible |
| visible-community | Visible Community | joaosilva | true |
| not-visible-community | Not Visible Community | joaosilva | false |
- And I am logged in as "joaosilva"
And I am on Joao Silva's homepage
- Then I should see "One community"
+ And I should see "One community"
When I go to Public Community's homepage
And I follow "Join"
- When I go to Joao Silva's homepage
+ And I go to Joao Silva's homepage
Then I should see "2 communities"
Scenario: display how many public/private friends I have
diff --git a/features/publish_article.feature b/features/publish_article.feature
index 5b62015..8f01d5d 100644
--- a/features/publish_article.feature
+++ b/features/publish_article.feature
@@ -42,11 +42,12 @@ Feature: publish article
Then I should see "Another name"
And I should not see "Sample Article"
+ @selenium
Scenario: getting an error message when publishing article with same name
Given I am logged in as "joaosilva"
And "Joao Silva" is a member of "Sample Community"
And I am on Joao Silva's control panel
- And I follow "Manage Content"
+ And I follow "Manage Content" and wait
And I follow "Spread"
And I check "Sample Community"
And I press "Spread this"
@@ -56,11 +57,11 @@ Feature: publish article
And I am on Maria Silva's control panel
And I follow "Manage Content"
And I follow "New content"
- And I follow "Text article with Textile markup language"
+ And I follow "Text article with Textile markup language" and wait
And I fill in the following:
| Title | Sample Article |
| Text | this is Maria's first published article |
- And I press "Save"
+ And I press "Save" and wait
And I follow "Spread"
And I check "Sample Community"
When I press "Spread this"
diff --git a/features/step_definitions/custom_webrat_steps.rb b/features/step_definitions/custom_webrat_steps.rb
index d4cf4ff..48d8e7f 100644
--- a/features/step_definitions/custom_webrat_steps.rb
+++ b/features/step_definitions/custom_webrat_steps.rb
@@ -1,5 +1,9 @@
When /^I should see "([^\"]+)" link$/ do |text|
- response.should have_selector("a:contains('#{text}')")
+ if response.class.to_s == 'Webrat::SeleniumResponse'
+ response.selenium.is_element_present("css=a:contains('#{text}')")
+ else
+ response.should have_selector("a:contains('#{text}')")
+ end
end
When /^I should not see "([^\"]+)" link$/ do |text|
diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb
index eac3939..a634a0e 100644
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -294,7 +294,11 @@ Given /^(.+) is disabled$/ do |enterprise_name|
end
Then /^The page title should contain "(.*)"$/ do |text|
- response.should have_selector("title:contains('#{text}')")
+ if response.class.to_s == 'Webrat::SeleniumResponse'
+ response.selenium.text('css=title').should include(text)
+ else
+ response.should have_selector("title:contains('#{text}')")
+ end
end
Given /^the mailbox is empty$/ do
diff --git a/features/step_definitions/selenium_steps.rb b/features/step_definitions/selenium_steps.rb
index 62eb790..e6acceb 100644
--- a/features/step_definitions/selenium_steps.rb
+++ b/features/step_definitions/selenium_steps.rb
@@ -85,6 +85,24 @@ Then /^"([^\"]*)" should be (left|right) aligned$/ do |element_class, align|
response.selenium.get_xpath_count("//*[contains(@class,'#{element_class}') and contains(@style,'float: #{align}')]").to_i.should be(1)
end
+When /^I confirm$/ do
+ selenium.get_confirmation
+end
+
+When /^I type "([^\"]*)" in TinyMCE field "([^\"]*)"$/ do |value, field_id|
+ response.selenium.type("dom=document.getElementById('#{field_id}_ifr').contentDocument.body", value)
+end
+
+When /^I answer the captcha$/ do
+ question = response.selenium.get_text("//label[@for='task_captcha_solution']").match(/What is the result of '(.+) = \?'/)[1]
+ answer = eval(question)
+ response.selenium.type("id=task_captcha_solution", answer)
+end
+
+When /^I refresh the page$/ do
+ response.selenium.refresh
+end
+
#### Noosfero specific steps ####
Then /^the select for category "([^\"]*)" should be visible$/ do |name|
diff --git a/features/step_definitions/webrat_steps.rb b/features/step_definitions/webrat_steps.rb
index c79a1ec..6534246 100644
--- a/features/step_definitions/webrat_steps.rb
+++ b/features/step_definitions/webrat_steps.rb
@@ -16,20 +16,49 @@ When /^I go to (.+)$/ do |page_name|
visit path_to(page_name)
end
+When /^I visit "([^\"]*)" and wait$/ do |page_name|
+ visit path_to(page_name)
+ selenium.wait_for_page_to_load(10000)
+end
+
When /^I press "([^\"]*)"$/ do |button|
click_button(button)
end
+When /^I press "([^\"]*)" and wait$/ do |button|
+ click_button(button)
+ selenium.wait_for_page_to_load(10000)
+end
+
When /^I follow "([^\"]*)"$/ do |link|
click_link(link)
end
+When /^I follow "([^\"]*)" and wait$/ do |link|
+ click_link(link)
+ selenium.wait_for_page_to_load(10000)
+end
+
+When /^I follow "([^\"]*)" and wait until "([^\"]*)" is present$/ do |link, element|
+ click_link(link)
+ selenium.wait_for_element(string_to_element_locator(element))
+end
+
When /^I follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
click_link_within(parent, link)
end
+When /^I follow "([^\"]*)" within "([^\"]*)" and wait$/ do |link, parent|
+ click_link_within(parent, link)
+ selenium.wait_for_page_to_load(10000)
+end
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
- fill_in(field, :with => value)
+ if response.class.to_s == 'Webrat::SeleniumResponse'
+ response.selenium.type("//*[@id=//label[contains(., '#{field}')]/@for]", value)
+ else
+ fill_in(field, :with => value)
+ end
end
When /^I fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
@@ -54,7 +83,11 @@ When /^I fill in the following:$/ do |fields|
end
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
- select(value, :from => field)
+ if response.class.to_s == 'Webrat::SeleniumResponse'
+ response.selenium.select("//*[@id=//label[contains(., '#{field}')]/@for]", value)
+ else
+ select(value, :from => field)
+ end
end
# Use this step in conjunction with Rail's datetime_select helper. For example:
@@ -173,7 +206,11 @@ Then /^I should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
end
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
- field_labeled(field).value.should =~ /#{value}/
+ if response.class.to_s == 'Webrat::SeleniumResponse'
+ response.selenium.get_value("//*[@id=//label[contains(., '#{field}')]/@for]").should match(value)
+ else
+ field_labeled(field).value.should =~ /#{value}/
+ end
end
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
@@ -189,7 +226,11 @@ Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
end
Then /^I should be on (.+)$/ do |page_name|
- URI.parse(current_url).path.should == path_to(page_name)
+ if response.class.to_s == 'Webrat::SeleniumResponse'
+ URI.parse(response.selenium.get_location).path.should == path_to(page_name)
+ else
+ URI.parse(current_url).path.should == path_to(page_name)
+ end
end
Then /^show me the page$/ do
diff --git a/features/suggest_article.feature b/features/suggest_article.feature
index 3286ae8..3df228e 100644
--- a/features/suggest_article.feature
+++ b/features/suggest_article.feature
@@ -22,23 +22,25 @@ Feature: suggest article
And I should see "suggested the publication of the article"
Then I should see "Highlight this article" within ".task_box"
+ @selenium
Scenario: an article is suggested and the admin approve it
Given I am on Sample Community's blog
- And I follow "Suggest an article"
- And I fill in the following:
- | Title | Suggestion |
- | Your name | Some Guy |
- | Email | someguy@somewhere.com |
- | Lead | This is my suggestion's lead |
- | Text | I like free software |
+ And I follow "Suggest an article" and wait
+ And I fill in "Title" with "Suggestion"
+ And I fill in "Your name" with "Some Guy"
+ And I fill in "Email" with "someguy@somewhere.com"
+ And I type "This is my suggestion's lead" in TinyMCE field "task_article_abstract"
+ And I type "I like free software" in TinyMCE field "task_article_body"
+ And I answer the captcha
And I press "Save"
And I am logged in as "joaosilva"
And I go to Sample Community's control panel
- When I follow "Process requests"
+ When I follow "Process requests" and wait
Then I should see "suggested the publication of the article: Suggestion."
When I choose "Accept"
And I select "sample-community/Blog" from "Select the folder where the article must be published"
And I press "Apply!"
And I go to Sample Community's blog
+ And I refresh the page
Then I should see "Suggestion"
Then I should see "I like free software"
diff --git a/features/support/selenium.rb b/features/support/selenium.rb
index 7eb3f30..8b04b7b 100644
--- a/features/support/selenium.rb
+++ b/features/support/selenium.rb
@@ -1,5 +1,7 @@
Webrat.configure do |config|
config.mode = :selenium
+ config.application_environment = :cucumber
+ config.selenium_browser_startup_timeout = 30000
end
Cucumber::Rails::World.use_transactional_fixtures = false
diff --git a/lib/noosfero.rb b/lib/noosfero.rb
index f255bd9..ce3cac8 100644
--- a/lib/noosfero.rb
+++ b/lib/noosfero.rb
@@ -66,7 +66,7 @@ module Noosfero
if ENV['RAILS_ENV'] == 'development'
development_url_options
elsif ENV['RAILS_ENV'] == 'cucumber'
- {:host => ''}
+ Webrat.configuration.mode == :rails ? { :host => '' } : { :port => Webrat.configuration.application_port }
else
{}
end
@@ -76,7 +76,6 @@ module Noosfero
@development_url_options || {}
end
-
end
require 'noosfero/constants'
diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb
index 463e4ca..8d4dde2 100644
--- a/test/functional/content_viewer_controller_test.rb
+++ b/test/functional/content_viewer_controller_test.rb
@@ -358,42 +358,42 @@ class ContentViewerControllerTest < Test::Unit::TestCase
assert_equal profile, assigns(:profile)
end
- should 'give link to edit the article for owner ' do
+ should 'give link to edit the article for owner' do
login_as('testinguser')
- get :view_page, :profile => 'testinguser', :page => []
- assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true
+ assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } }
end
should 'not give link to edit the article for non-logged-in people' do
- get :view_page, :profile => 'testinguser', :page => []
- assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true
+ assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } }
end
should 'not give link to edit article for other people' do
login_as(create_user('anotheruser').login)
- get :view_page, :profile => 'testinguser', :page => []
- assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true
+ assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } }
end
should 'give link to create new article' do
login_as('testinguser')
- get :view_page, :profile => 'testinguser', :page => []
- assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true
+ assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } }
end
should 'give no link to create new article for non-logged in people ' do
- get :view_page, :profile => 'testinguser', :page => []
- assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true
+ assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } }
end
should 'give no link to create new article for other people' do
login_as(create_user('anotheruser').login)
- get :view_page, :profile => 'testinguser', :page => []
- assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true
+ assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } }
end
should 'give link to create new article inside folder' do
login_as('testinguser')
folder = Folder.create!(:name => 'myfolder', :profile => @profile)
- get :view_page, :profile => 'testinguser', :page => [ 'myfolder' ]
- assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [ 'myfolder' ], :toolbar => true
+ assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } }
end
should 'not give access to private articles if logged off' do
@@ -468,7 +468,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text')
login_as(profile.identifier)
- get :view_page, :profile => profile.identifier, :page => ['myarticle']
+ xhr :get, :view_page, :profile => profile.identifier, :page => ['myarticle'], :toolbar => true
assert_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + profile.identifier + '/cms/publish/' + page.id.to_s)}
end
@@ -501,7 +501,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
prof.affiliate(profile, Profile::Roles.all_roles(prof.environment.id))
login_as(profile.identifier)
- get :view_page, :profile => prof.identifier, :page => ['myarticle']
+ xhr :get, :view_page, :profile => prof.identifier, :page => ['myarticle'], :toolbar => true
assert_no_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + prof.identifier + '/cms/publish/' + page.id.to_s)}
end
@@ -662,15 +662,15 @@ class ContentViewerControllerTest < Test::Unit::TestCase
login_as('testinguser')
folder = Folder.create!(:name => 'myfolder', :profile => @profile)
folder.children << TextileArticle.new(:name => 'children-article', :profile => @profile)
- get :view_page, :profile => 'testinguser', :page => [ 'myfolder', 'children-article' ]
- assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } }
+ xhr :get, :view_page, :profile => 'testinguser', :page => [ 'myfolder', 'children-article' ], :toolbar => true
+ assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } }
end
should "display 'New article' when create children of folder" do
login_as(profile.identifier)
a = Folder.new(:name => 'article folder'); profile.articles << a; a.save!
Article.stubs(:short_description).returns('bli')
- get :view_page, :profile => profile.identifier, :page => [a.path]
+ xhr :get, :view_page, :profile => profile.identifier, :page => [a.path], :toolbar => true
assert_tag :tag => 'a', :content => 'New article'
end
@@ -678,7 +678,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
login_as(profile.identifier)
a = Blog.create!(:name => 'article folder', :profile => profile)
Article.stubs(:short_description).returns('bli')
- get :view_page, :profile => profile.identifier, :page => [a.path]
+ xhr :get, :view_page, :profile => profile.identifier, :page => [a.path], :toolbar => true
assert_tag :tag => 'a', :content => 'New post'
end
@@ -687,21 +687,21 @@ class ContentViewerControllerTest < Test::Unit::TestCase
a = Blog.create!(:name => 'article folder', :profile => profile)
Article.stubs(:short_description).returns('bli')
t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile)
- get :view_page, :profile => profile.identifier, :page => [t.path]
+ xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true
assert_tag :tag => 'a', :content => 'New post'
end
should 'display button to remove article' do
login_as(profile.identifier)
t = TextileArticle.create!(:name => 'article to destroy', :profile => profile)
- get :view_page, :profile => profile.identifier, :page => [t.path]
+ xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true
assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"}
end
should 'not display delete button for homepage' do
login_as(profile.identifier)
page = profile.home_page
- get :view_page, :profile => profile.identifier, :page => page.explode_path
+ xhr :get, :view_page, :profile => profile.identifier, :page => page.explode_path, :toolbar => true
assert_no_tag :tag => 'a', :content => 'Delete', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/destroy/#{page.id}" }
end
@@ -746,7 +746,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
should "display 'Upload files' when create children of image gallery" do
login_as(profile.identifier)
f = Gallery.create!(:name => 'gallery', :profile => profile)
- get :view_page, :profile => profile.identifier, :page => f.explode_path
+ xhr :get, :view_page, :profile => profile.identifier, :page => f.explode_path, :toolbar => true
assert_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{f.id}/}
end
@@ -755,7 +755,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
folder1 = Gallery.create!(:name => 'gallery1', :profile => profile)
folder1.children << folder2 = Folder.new(:name => 'gallery2', :profile => profile)
- get :view_page, :profile => profile.identifier, :page => folder2.explode_path
+ xhr :get, :view_page, :profile => profile.identifier, :page => folder2.explode_path, :toolbar => true
assert_tag :tag => 'a', :content => 'New article', :attributes => {:href =>/parent_id=#{folder2.id}/}
end
@@ -763,7 +763,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
login_as(profile.identifier)
folder = Gallery.create!(:name => 'gallery', :profile => profile)
file = UploadedFile.create!(:profile => profile, :parent => folder, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'))
- get :view_page, :profile => profile.identifier, :page => file.explode_path, :view => true
+ xhr :get, :view_page, :profile => profile.identifier, :page => file.explode_path, :view => true, :toolbar => true
assert_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{folder.id}/}
end
@@ -863,7 +863,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
should "not display 'Upload files' when viewing blog" do
login_as(profile.identifier)
b = Blog.create!(:name => 'article folder', :profile => profile)
- get :view_page, :profile => profile.identifier, :page => b.explode_path
+ xhr :get, :view_page, :profile => profile.identifier, :page => b.explode_path, :toolbar => true
assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/}
end
@@ -871,7 +871,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
login_as(profile.identifier)
b = Blog.create!(:name => 'article folder', :profile => profile)
blog_post = TextileArticle.create!(:name => 'children-article', :profile => profile, :parent => b)
- get :view_page, :profile => profile.identifier, :page => blog_post.explode_path
+ xhr :get, :view_page, :profile => profile.identifier, :page => blog_post.explode_path, :toolbar => true
assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/}
end
@@ -913,7 +913,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
login_as u.identifier
a = c.articles.create!(:name => 'test-article', :last_changed_by => profile, :published => true)
- get :view_page, :profile => c.identifier, :page => a.explode_path
+ xhr :get, :view_page, :profile => c.identifier, :page => a.explode_path, :toolbar => true
assert_tag :tag => 'a', :content => 'New article'
end
@@ -963,8 +963,8 @@ class ContentViewerControllerTest < Test::Unit::TestCase
should 'display link to edit blog for allowed' do
blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog')
login_as(profile.identifier)
- get :view_page, :profile => profile.identifier, :page => blog.explode_path
- assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{blog.id}" }, :content => 'Configure blog' }
+ xhr :get, :view_page, :profile => profile.identifier, :page => blog.explode_path, :toolbar => true
+ assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{blog.id}" }, :content => 'Configure blog' }
end
# Forum
@@ -1054,7 +1054,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
login_as(profile.identifier)
a = Forum.create!(:name => 'article folder', :profile => profile)
Article.stubs(:short_description).returns('bli')
- get :view_page, :profile => profile.identifier, :page => [a.path]
+ xhr :get, :view_page, :profile => profile.identifier, :page => [a.path], :toolbar => true
assert_tag :tag => 'a', :content => 'New discussion topic'
end
@@ -1063,7 +1063,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
a = Forum.create!(:name => 'article folder', :profile => profile)
Article.stubs(:short_description).returns('bli')
t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile)
- get :view_page, :profile => profile.identifier, :page => [t.path]
+ xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true
assert_tag :tag => 'a', :content => 'New discussion topic'
end
@@ -1085,7 +1085,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase
should "not display 'Upload files' when viewing forum" do
login_as(profile.identifier)
b = Forum.create!(:name => 'article folder', :profile => profile)
- get :view_page, :profile => profile.identifier, :page => b.explode_path
+ xhr :get, :view_page, :profile => profile.identifier, :page => b.explode_path, :toolbar => true
assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/}
end
@@ -1093,43 +1093,43 @@ class ContentViewerControllerTest < Test::Unit::TestCase
login_as(profile.identifier)
b = Forum.create!(:name => 'article folder', :profile => profile)
forum_post = TextileArticle.create!(:name => 'children-article', :profile => profile, :parent => b)
- get :view_page, :profile => profile.identifier, :page => forum_post.explode_path
+ xhr :get, :view_page, :profile => profile.identifier, :page => forum_post.explode_path, :toolbar => true
assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/}
end
should 'display link to edit forum for allowed' do
forum = fast_create(Forum, :profile_id => profile.id, :path => 'forum')
login_as(profile.identifier)
- get :view_page, :profile => profile.identifier, :page => forum.explode_path
- assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{forum.id}" }, :content => 'Configure forum' }
+ xhr :get, :view_page, :profile => profile.identifier, :page => forum.explode_path, :toolbar => true
+ assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{forum.id}" }, :content => 'Configure forum' }
end
should 'display add translation link if article is translatable' do
login_as @profile.identifier
textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en')
- get :view_page, :profile => @profile.identifier, :page => textile.explode_path
+ xhr :get, :view_page, :profile => @profile.identifier, :page => textile.explode_path, :toolbar => true
assert_tag :a, :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?article%5Btranslation_of_id%5D=#{textile.id}&type=#{TextileArticle}" }
end
should 'not display add translation link if article is not translatable' do
login_as @profile.identifier
blog = fast_create(Blog, :profile_id => @profile.id, :path => 'blog')
- get :view_page, :profile => @profile.identifier, :page => blog.explode_path
+ xhr :get, :view_page, :profile => @profile.identifier, :page => blog.explode_path, :toolbar => true
assert_no_tag :a, :attributes => { :content => 'Add translation', :class => /icon-locale/ }
end
should 'not display add translation link if article hasnt a language defined' do
login_as @profile.identifier
textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile')
- get :view_page, :profile => @profile.identifier, :page => textile.explode_path
+ xhr :get, :view_page, :profile => @profile.identifier, :page => textile.explode_path, :toolbar => true
assert_no_tag :a, :attributes => { :content => 'Add translation', :class => /icon-locale/ }
end
- should 'diplay translations link if article has translations' do
+ should 'display translations link if article has translations' do
login_as @profile.identifier
textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en')
translation = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'translation', :language => 'es', :translation_of_id => textile)
- get :view_page, :profile => @profile.identifier, :page => textile.explode_path
+ xhr :get, :view_page, :profile => @profile.identifier, :page => textile.explode_path, :toolbar => true
assert_tag :a, :attributes => { :class => /article-translations-menu/, :onclick => /toggleSubmenu/ }
end
@@ -1377,9 +1377,15 @@ class ContentViewerControllerTest < Test::Unit::TestCase
should 'suggest article link displayed into article-actions div' do
community = fast_create(Community)
blog = fast_create(Blog, :profile_id => community.id, :path => 'blog')
- get :view_page, :profile => community.identifier, :page => [ 'blog' ]
- assert_tag :tag => 'div', :attributes => {:id => 'article-actions'},
- :descendant => {:tag => 'a', :attributes => {:id => 'suggest-article-link'}}
+ xhr :get, :view_page, :profile => community.identifier, :page => [ 'blog' ], :toolbar => true
+ assert_tag :tag => 'a', :attributes => { :id => 'suggest-article-link' }
+ end
+
+ should 'render toolbar when it is an ajax request' do
+ community = fast_create(Community)
+ blog = fast_create(Blog, :profile_id => community.id, :path => 'blog')
+ xhr :get, :view_page, :profile => community.identifier, :page => ['blog'], :toolbar => true
+ assert_tag :tag => 'div', :attributes => { :id => 'article-header' }
end
end
diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb
index 331f45a..d0ef9d9 100644
--- a/test/functional/profile_controller_test.rb
+++ b/test/functional/profile_controller_test.rb
@@ -174,8 +174,9 @@ class ProfileControllerTest < Test::Unit::TestCase
should 'not show Leave This Community button for non-registered users' do
community = Community.create!(:name => 'my test community')
- get :index, :profile => community.identifier
- assert_no_tag :tag => 'a', :attributes => { :href => "/profile/#{@profile.identifier}/leave" }
+ community.boxes.first.blocks << block = ProfileInfoBlock.create!
+ get :profile_info, :profile => community.identifier, :block_id => block.id
+ assert_no_match /\/profile\/#{@profile.identifier}\/leave/, @response.body
end
should 'check access before displaying profile' do
@@ -190,26 +191,29 @@ class ProfileControllerTest < Test::Unit::TestCase
should 'display add friend button' do
login_as(@profile.identifier)
friend = create_user_full('friendtestuser').person
- get :index, :profile => friend.identifier
- assert_tag :tag => 'a', :content => 'Add friend'
+ friend.boxes.first.blocks << block = ProfileInfoBlock.create!
+ get :profile_info, :profile => friend.identifier, :block_id => block.id
+ assert_match /Add friend/, @response.body
end
should 'not display add friend button if user already request friendship' do
login_as(@profile.identifier)
friend = create_user_full('friendtestuser').person
+ friend.boxes.first.blocks << block = ProfileInfoBlock.create!
AddFriend.create!(:person => @profile, :friend => friend)
- get :index, :profile => friend.identifier
- assert_no_tag :tag => 'a', :content => 'Add friend'
+ get :profile_info, :profile => friend.identifier, :block_id => block.id
+ assert_no_match /Add friend/, @response.body
end
should 'not display add friend button if user already friend' do
login_as(@profile.identifier)
friend = create_user_full('friendtestuser').person
+ friend.boxes.first.blocks << block = ProfileInfoBlock.create!
@profile.add_friend(friend)
@profile.friends.reload
assert @profile.is_a_friend?(friend)
- get :index, :profile => friend.identifier
- assert_no_tag :tag => 'a', :content => 'Add friend'
+ get :profile_info, :profile => friend.identifier, :block_id => block.id
+ assert_no_match /Add friend/, @response.body
end
should 'show message for disabled enterprise' do
@@ -293,82 +297,91 @@ class ProfileControllerTest < Test::Unit::TestCase
should 'display contact us for enterprises' do
ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise')
- get :index, :profile => 'my-test-enterprise'
- assert_tag :tag => 'a', :attributes => { :href => "/contact/my-test-enterprise/new" }, :content => /Send/
+ ent.boxes.first.blocks << block = ProfileInfoBlock.create!
+ get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id
+ assert_match /\/contact\/my-test-enterprise\/new/, @response.body
end
should 'not display contact us for non-enterprises' do
- get :index, :profile => @profile.identifier
- assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{@profile.identifier}/new" }, :content => /Send/
+ @profile.boxes.first.blocks << block = ProfileInfoBlock.create!
+ get :profile_info, :profile => @profile, :block_id => block.id
+ assert_no_match /\/contact\/#{@profile.identifier}\/new/, @response.body
end
should 'display contact us only if enabled' do
- ent = fast_create(Enterprise, :name => 'my test enterprise', :identifier => 'my-test-enterprise')
+ ent = Enterprise.create! :name => 'my test enterprise', :identifier => 'my-test-enterprise'
+ ent.boxes.first.blocks << block = ProfileInfoBlock.create!
ent.update_attribute(:enable_contact_us, false)
- get :index, :profile => 'my-test-enterprise'
- assert_no_tag :tag => 'a', :attributes => { :href => "/contact/my-test-enterprise/new" }, :content => /Send/
+ get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id
+ assert_no_match /\/contact\/my-test-enterprise\/new/, @response.body
end
should 'display contact button only if friends' do
friend = create_user_full('friend_user').person
+ friend.boxes.first.blocks << block = ProfileInfoBlock.create!
@profile.add_friend(friend)
env = Environment.default
env.disable('disable_contact_person')
env.save!
login_as(@profile.identifier)
- get :index, :profile => friend.identifier
- assert_tag :tag => 'a', :attributes => { :href => "/contact/#{friend.identifier}/new" }
+ get :profile_info, :profile => friend.identifier, :block_id => block.id
+ assert_match /\/contact\/#{friend.identifier}\/new/, @response.body
end
should 'not display contact button if no friends' do
nofriend = create_user_full('no_friend').person
+ nofriend.boxes.first.blocks << block = ProfileInfoBlock.create!
login_as(@profile.identifier)
- get :index, :profile => nofriend.identifier
- assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{nofriend.identifier}/new" }
+ get :profile_info, :profile => nofriend.identifier, :block_id => block.id
+ assert_no_match /\/contact\/#{nofriend.identifier}\/new/, @response.body
end
should 'display contact button only if friends and its enable in environment' do
friend = create_user_full('friend_user').person
+ friend.boxes.first.blocks << block = ProfileInfoBlock.create!
env = Environment.default
env.disable('disable_contact_person')
env.save!
@profile.add_friend(friend)
login_as(@profile.identifier)
- get :index, :profile => friend.identifier
- assert_tag :tag => 'a', :attributes => { :href => "/contact/#{friend.identifier}/new" }
+ get :profile_info, :profile => friend.identifier, :block_id => block.id
+ assert_match /\/contact\/#{friend.identifier}\/new/, @response.body
end
should 'not display contact button if friends and its disable in environment' do
friend = create_user_full('friend_user').person
+ friend.boxes.first.blocks << block = ProfileInfoBlock.create!
env = Environment.default
env.enable('disable_contact_person')
env.save!
@profile.add_friend(friend)
login_as(@profile.identifier)
- get :index, :profile => friend.identifier
- assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{friend.identifier}/new" }
+ get :profile_info, :profile => friend.identifier, :block_id => block.id
+ assert_no_match /\/contact\/#{friend.identifier}\/new/, @response.body
end
should 'display contact button for community if its enable in environment' do
env = Environment.default
community = Community.create!(:name => 'my test community', :environment => env)
+ community.boxes.first.blocks << block = ProfileInfoBlock.create!
env.disable('disable_contact_community')
env.save!
community.add_member(@profile)
login_as(@profile.identifier)
- get :index, :profile => community.identifier
- assert_tag :tag => 'a', :attributes => { :href => "/contact/#{community.identifier}/new" }
+ get :profile_info, :profile => community.identifier, :block_id => block.id
+ assert_match /\/contact\/#{community.identifier}\/new/, @response.body
end
should 'not display contact button for community if its disable in environment' do
env = Environment.default
community = Community.create!(:name => 'my test community', :environment => env)
+ community.boxes.first.blocks << block = ProfileInfoBlock.create!
env.enable('disable_contact_community')
env.save!
community.add_member(@profile)
login_as(@profile.identifier)
- get :index, :profile => community.identifier
- assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{community.identifier}/new" }
+ get :profile_info, :profile => community.identifier, :block_id => block.id
+ assert_no_match /\/contact\/#{community.identifier}\/new/, @response.body
end
should 'actually join profile' do
diff --git a/test/functional/themes_controller_test.rb b/test/functional/themes_controller_test.rb
index 6615e0e..998d0b7 100644
--- a/test/functional/themes_controller_test.rb
+++ b/test/functional/themes_controller_test.rb
@@ -145,7 +145,7 @@ class ThemesControllerTest < Test::Unit::TestCase
should 'display dialog for creating new CSS' do
theme = Theme.create('mytheme', :owner => profile)
- @request.expects(:xhr?).returns(true)
+ @request.stubs(:xhr?).returns(true)
get :add_css, :profile => 'testinguser', :id => 'mytheme'
assert_tag :tag => 'form', :attributes => { :action => '/myprofile/testinguser/themes/add_css/mytheme', :method => /post/i}
@@ -204,7 +204,7 @@ class ThemesControllerTest < Test::Unit::TestCase
should 'display the "add image" dialog' do
theme = Theme.create('mytheme', :owner => profile)
- @request.expects(:xhr?).returns(true)
+ @request.stubs(:xhr?).returns(true)
get :add_image, :profile => 'testinguser', :id => 'mytheme'
assert_tag :tag => 'form', :attributes => { :action => '/myprofile/testinguser/themes/add_image/mytheme', :method => /post/i, :enctype => 'multipart/form-data' }, :descendant => { :tag => 'input', :attributes => { :name => 'image', :type => 'file' } }
@@ -212,7 +212,7 @@ class ThemesControllerTest < Test::Unit::TestCase
should 'be able to add new image to theme' do
theme = Theme.create('mytheme', :owner => profile)
- @request.expects(:xhr?).returns(false)
+ @request.stubs(:xhr?).returns(false)
post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary)
assert_redirected_to :action => "edit", :id => 'mytheme'
diff --git a/test/unit/lightbox_helper_test.rb b/test/unit/lightbox_helper_test.rb
index 67e2820..56ae9e2 100644
--- a/test/unit/lightbox_helper_test.rb
+++ b/test/unit/lightbox_helper_test.rb
@@ -56,4 +56,10 @@ class LightboxHelperTest < Test::Unit::TestCase
assert lightbox?
end
+ should 'provide lightbox_remote_button' do
+ expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'remote-lbOn' })).returns('[button]')
+
+ assert_equal '[button]', lightbox_remote_button('type', 'label', { :action => 'popup'})
+ end
+
end
diff --git a/vendor/plugins/noosfero_caching/init.rb b/vendor/plugins/noosfero_caching/init.rb
index 4fe24cb..5a05364 100644
--- a/vendor/plugins/noosfero_caching/init.rb
+++ b/vendor/plugins/noosfero_caching/init.rb
@@ -17,7 +17,7 @@ module NoosferoHttpCaching
if request.path == '/'
n = environment.home_cache_in_minutes
else
- if params[:controller] != 'account' && request.path !~ /^\/admin/
+ if params[:controller] != 'account' && !request.xhr? && request.path !~ /^\/admin/
n = environment.general_cache_in_minutes
end
end
@@ -28,7 +28,7 @@ module NoosferoHttpCaching
end
def noosfero_session_check_before
- return if params[:controller] == 'account'
+ return if params[:controller] == 'account' || request.xhr?
headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s
end
--
libgit2 0.21.2