diff --git a/app/controllers/public/tag_controller.rb b/app/controllers/public/tag_controller.rb deleted file mode 100644 index 89f06b3..0000000 --- a/app/controllers/public/tag_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class TagController < PublicController - -end diff --git a/features/search.feature b/features/search.feature new file mode 100644 index 0000000..926c835 --- /dev/null +++ b/features/search.feature @@ -0,0 +1,88 @@ +Feature: search + As a noosfero user + I want to search + In order to find stuff + + Scenario: simple search for person + Given I am on the homepage + And the following users + | login | name | + | joaosilva | Joao Silva | + | josearaujo | Jose Araujo | + When I follow "Search" + And I fill in "query" with "Silva" + And I press "Search" + Then I should see "Joao Silva" + And I should not see "Jose Araujo" + + Scenario: simple search for community + Given I am on the homepage + And the following communities + | identifier | name | + | boring-community | Boring community | + | fancy-community | Fancy community | + And I follow "Search" + And I fill in "query" with "fancy" + And I press "Search" + Then I should see "Fancy community" + And I should not see "Boring community" + + Scenario: simple search for enterprise + Given I am on the homepage + And the following enterprises + | identifier | name | + | products-factory | Products factory | + | services-provider | Services Provider | + And I follow "Search" + And I fill in "query" with "services" + And I press "Search" + Then I should see "Services Provider" + And I should not see "Products factory" + + Scenario: simple search for content + Given the following users + | login | name | + | joaosilva | Joao Silva | + And the following articles + | owner | name | body | + | joaosilva | bees and butterflies | this is an article about bees and butterflies | + | joaosilva | whales and dolphins | this is an article about whales and dolphins | + And I am on the homepage + When I follow "Search" + And I fill in "query" with "whales" + And I press "Search" + Then I should see "whales and dolphins" + And I should not see "bees and butterflies" + + + Scenario: simple search for product + Given the following enterprises + | identifier | name | + | colivre | Colivre | + And the following products + | owner | name | + | colivre | social networks consultancy | + | colivre | wikis consultancy | + And I am on the homepage + When I follow "Search" + And I fill in "query" with "wikis" + And I press "Search" + Then I should see "wikis consultancy" + And I should not see "social networks consultancy" + + + Scenario: simple search for event + Given the following communities + | identifier | name | + | nice-people | Nice people | + And the following events + | owner | name | + | nice-people | Group meeting | + | nice-people | John Doe's birthday | + And I am on the homepage + When I follow "Search" + And I fill in "query" with "birthday" + And I press "Search" + Then I should see "John Doe's birthday" + And I should not see "Group meeting" + diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb new file mode 100644 index 0000000..48d4a65 --- /dev/null +++ b/features/step_definitions/noosfero_steps.rb @@ -0,0 +1,42 @@ +Given /^the following users$/ do |table| + # table is a Cucumber::Ast::Table + table.hashes.each do |item| + person_data = item.dup + person_data.delete("login") + User.create!(:login => item[:login], :password => '123456', :password_confirmation => '123456', :email => item[:login] + "@example.com", :person_data => person_data) + end +end + +Given /^the following communities$/ do |table| + table.hashes.each do |item| + Community.create!(item) + end +end + +Given /^the following enterprises$/ do |table| + table.hashes.each do |item| + Enterprise.create!(item) + end +end + +Given /^the following (articles|events)$/ do |content, table| + klass = { + 'articles' => TextileArticle, + 'events' => Event, + }[content] || raise("Don't know how to build %s" % content) + table.hashes.each do |item| + data = item.dup + owner_identifier = data.delete("owner") + owner = Profile[owner_identifier] + TextileArticle.create!(data.merge(:profile => owner)) + end +end + +Given /^the following products$/ do |table| + table.hashes.each do |item| + data = item.dup + owner = Enterprise[data.delete("owner")] + Product.create!(data.merge(:enterprise => owner)) + end +end + diff --git a/features/support/paths.rb b/features/support/paths.rb index f2a9232..84c52da 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -10,6 +10,9 @@ module NavigationHelpers when /the homepage/ '/' + + when /^\// + page_name # Add more mappings here. # Here is a more fancy example: diff --git a/features/tags.feature b/features/tags.feature new file mode 100644 index 0000000..7aa5233 --- /dev/null +++ b/features/tags.feature @@ -0,0 +1,33 @@ +Feature: tags + As a Noosfero user + I want to find content tagged with a given tag + In order to find easily the things I am looking for + + Background: + Given the following users + | login | + | josesilva | + | joaoaraujo | + And the following articles + | owner | name | body | tag_list | + | josesilva | save the whales | ... | environment, whales | + | joaoaraujo | the Amazon is being destroyed | ... | environment, forest, amazon | + + Scenario: viewing tag cloud + When I go to /tag + Then I should see "environment" + And I should see "whales" + And I should see "forest" + And I should see "amazon" + + Scenario: viewing a single tag + When I go to /tag + And I follow "environment" + Then I should see "save the whales" + And I should see "the Amazon is being destroyed" + + Scenario: viewing another tag + When I go to /tag + And I follow "whales" + Then I should see "save the whales" + And I should not see "the Amazon is being destroyed" -- libgit2 0.21.2