Commit d6c35f54c92620b35742d32ddeb9c92851b126be
1 parent
42538dc2
Exists in
master
and in
23 other branches
ActionItem1240: adding some acceptance tests
Showing
5 changed files
with
166 additions
and
3 deletions
Show diff stats
app/controllers/public/tag_controller.rb
| ... | ... | @@ -0,0 +1,88 @@ |
| 1 | +Feature: search | |
| 2 | + As a noosfero user | |
| 3 | + I want to search | |
| 4 | + In order to find stuff | |
| 5 | + | |
| 6 | + Scenario: simple search for person | |
| 7 | + Given I am on the homepage | |
| 8 | + And the following users | |
| 9 | + | login | name | | |
| 10 | + | joaosilva | Joao Silva | | |
| 11 | + | josearaujo | Jose Araujo | | |
| 12 | + When I follow "Search" | |
| 13 | + And I fill in "query" with "Silva" | |
| 14 | + And I press "Search" | |
| 15 | + Then I should see "Joao Silva" | |
| 16 | + And I should not see "Jose Araujo" | |
| 17 | + | |
| 18 | + Scenario: simple search for community | |
| 19 | + Given I am on the homepage | |
| 20 | + And the following communities | |
| 21 | + | identifier | name | | |
| 22 | + | boring-community | Boring community | | |
| 23 | + | fancy-community | Fancy community | | |
| 24 | + And I follow "Search" | |
| 25 | + And I fill in "query" with "fancy" | |
| 26 | + And I press "Search" | |
| 27 | + Then I should see "Fancy community" | |
| 28 | + And I should not see "Boring community" | |
| 29 | + | |
| 30 | + Scenario: simple search for enterprise | |
| 31 | + Given I am on the homepage | |
| 32 | + And the following enterprises | |
| 33 | + | identifier | name | | |
| 34 | + | products-factory | Products factory | | |
| 35 | + | services-provider | Services Provider | | |
| 36 | + And I follow "Search" | |
| 37 | + And I fill in "query" with "services" | |
| 38 | + And I press "Search" | |
| 39 | + Then I should see "Services Provider" | |
| 40 | + And I should not see "Products factory" | |
| 41 | + | |
| 42 | + Scenario: simple search for content | |
| 43 | + Given the following users | |
| 44 | + | login | name | | |
| 45 | + | joaosilva | Joao Silva | | |
| 46 | + And the following articles | |
| 47 | + | owner | name | body | | |
| 48 | + | joaosilva | bees and butterflies | this is an article about bees and butterflies | | |
| 49 | + | joaosilva | whales and dolphins | this is an article about whales and dolphins | | |
| 50 | + And I am on the homepage | |
| 51 | + When I follow "Search" | |
| 52 | + And I fill in "query" with "whales" | |
| 53 | + And I press "Search" | |
| 54 | + Then I should see "whales and dolphins" | |
| 55 | + And I should not see "bees and butterflies" | |
| 56 | + | |
| 57 | + | |
| 58 | + Scenario: simple search for product | |
| 59 | + Given the following enterprises | |
| 60 | + | identifier | name | | |
| 61 | + | colivre | Colivre | | |
| 62 | + And the following products | |
| 63 | + | owner | name | | |
| 64 | + | colivre | social networks consultancy | | |
| 65 | + | colivre | wikis consultancy | | |
| 66 | + And I am on the homepage | |
| 67 | + When I follow "Search" | |
| 68 | + And I fill in "query" with "wikis" | |
| 69 | + And I press "Search" | |
| 70 | + Then I should see "wikis consultancy" | |
| 71 | + And I should not see "social networks consultancy" | |
| 72 | + | |
| 73 | + | |
| 74 | + Scenario: simple search for event | |
| 75 | + Given the following communities | |
| 76 | + | identifier | name | | |
| 77 | + | nice-people | Nice people | | |
| 78 | + And the following events | |
| 79 | + | owner | name | | |
| 80 | + | nice-people | Group meeting | | |
| 81 | + | nice-people | John Doe's birthday | | |
| 82 | + And I am on the homepage | |
| 83 | + When I follow "Search" | |
| 84 | + And I fill in "query" with "birthday" | |
| 85 | + And I press "Search" | |
| 86 | + Then I should see "John Doe's birthday" | |
| 87 | + And I should not see "Group meeting" | |
| 88 | + | ... | ... |
| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | +Given /^the following users$/ do |table| | |
| 2 | + # table is a Cucumber::Ast::Table | |
| 3 | + table.hashes.each do |item| | |
| 4 | + person_data = item.dup | |
| 5 | + person_data.delete("login") | |
| 6 | + User.create!(:login => item[:login], :password => '123456', :password_confirmation => '123456', :email => item[:login] + "@example.com", :person_data => person_data) | |
| 7 | + end | |
| 8 | +end | |
| 9 | + | |
| 10 | +Given /^the following communities$/ do |table| | |
| 11 | + table.hashes.each do |item| | |
| 12 | + Community.create!(item) | |
| 13 | + end | |
| 14 | +end | |
| 15 | + | |
| 16 | +Given /^the following enterprises$/ do |table| | |
| 17 | + table.hashes.each do |item| | |
| 18 | + Enterprise.create!(item) | |
| 19 | + end | |
| 20 | +end | |
| 21 | + | |
| 22 | +Given /^the following (articles|events)$/ do |content, table| | |
| 23 | + klass = { | |
| 24 | + 'articles' => TextileArticle, | |
| 25 | + 'events' => Event, | |
| 26 | + }[content] || raise("Don't know how to build %s" % content) | |
| 27 | + table.hashes.each do |item| | |
| 28 | + data = item.dup | |
| 29 | + owner_identifier = data.delete("owner") | |
| 30 | + owner = Profile[owner_identifier] | |
| 31 | + TextileArticle.create!(data.merge(:profile => owner)) | |
| 32 | + end | |
| 33 | +end | |
| 34 | + | |
| 35 | +Given /^the following products$/ do |table| | |
| 36 | + table.hashes.each do |item| | |
| 37 | + data = item.dup | |
| 38 | + owner = Enterprise[data.delete("owner")] | |
| 39 | + Product.create!(data.merge(:enterprise => owner)) | |
| 40 | + end | |
| 41 | +end | |
| 42 | + | ... | ... |
features/support/paths.rb
| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | +Feature: tags | |
| 2 | + As a Noosfero user | |
| 3 | + I want to find content tagged with a given tag | |
| 4 | + In order to find easily the things I am looking for | |
| 5 | + | |
| 6 | + Background: | |
| 7 | + Given the following users | |
| 8 | + | login | | |
| 9 | + | josesilva | | |
| 10 | + | joaoaraujo | | |
| 11 | + And the following articles | |
| 12 | + | owner | name | body | tag_list | | |
| 13 | + | josesilva | save the whales | ... | environment, whales | | |
| 14 | + | joaoaraujo | the Amazon is being destroyed | ... | environment, forest, amazon | | |
| 15 | + | |
| 16 | + Scenario: viewing tag cloud | |
| 17 | + When I go to /tag | |
| 18 | + Then I should see "environment" | |
| 19 | + And I should see "whales" | |
| 20 | + And I should see "forest" | |
| 21 | + And I should see "amazon" | |
| 22 | + | |
| 23 | + Scenario: viewing a single tag | |
| 24 | + When I go to /tag | |
| 25 | + And I follow "environment" | |
| 26 | + Then I should see "save the whales" | |
| 27 | + And I should see "the Amazon is being destroyed" | |
| 28 | + | |
| 29 | + Scenario: viewing another tag | |
| 30 | + When I go to /tag | |
| 31 | + And I follow "whales" | |
| 32 | + Then I should see "save the whales" | |
| 33 | + And I should not see "the Amazon is being destroyed" | ... | ... |