Added cucumber step for searching, and feature for searching for tags.
This commit is contained in:
parent
a8737ab318
commit
1bd693eb14
4 changed files with 24 additions and 1 deletions
|
|
@ -132,3 +132,12 @@ end
|
||||||
Then /^I should get download alert$/ do
|
Then /^I should get download alert$/ do
|
||||||
page.evaluate_script("window.alert = function() { return true; }")
|
page.evaluate_script("window.alert = function() { return true; }")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I search for "([^\"]*)"$/ do |search_term|
|
||||||
|
When "I fill in \"q\" with \"#{search_term}\""
|
||||||
|
page.execute_script <<-JS
|
||||||
|
var e = jQuery.Event("keypress");
|
||||||
|
e.keyCode = 13;
|
||||||
|
$("#q").trigger(e);
|
||||||
|
JS
|
||||||
|
end
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
module NavigationHelpers
|
module NavigationHelpers
|
||||||
def path_to(page_name)
|
def path_to(page_name)
|
||||||
case page_name
|
case page_name
|
||||||
when /^the home page$/
|
when /^the home(?: )?page$/
|
||||||
root_path
|
root_path
|
||||||
when /^step (\d)$/
|
when /^step (\d)$/
|
||||||
if $1.to_i == 1
|
if $1.to_i == 1
|
||||||
|
|
@ -9,6 +9,8 @@ module NavigationHelpers
|
||||||
else
|
else
|
||||||
getting_started_path(:step => $1)
|
getting_started_path(:step => $1)
|
||||||
end
|
end
|
||||||
|
when /^the tag page for "([^\"]*)"$/
|
||||||
|
tag_path($1)
|
||||||
when /^its ([\w ]+) page$/
|
when /^its ([\w ]+) page$/
|
||||||
send("#{$1.gsub(/\W+/, '_')}_path", @it)
|
send("#{$1.gsub(/\W+/, '_')}_path", @it)
|
||||||
when /^the ([\w ]+) page$/
|
when /^the ([\w ]+) page$/
|
||||||
|
|
|
||||||
8
features/tags.feature
Normal file
8
features/tags.feature
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
@javascript
|
||||||
|
Feature: Interacting with tags
|
||||||
|
|
||||||
|
Scenario: Searching for a tag
|
||||||
|
Given I am signed in
|
||||||
|
And I am on the homepage
|
||||||
|
And I search for "#rockstar"
|
||||||
|
Then I should be on the tag page for "rockstar"
|
||||||
|
|
@ -12,6 +12,10 @@ FixtureBuilder.configure do |fbuilder|
|
||||||
bob = Factory(:user_with_aspect, :username => "bob")
|
bob = Factory(:user_with_aspect, :username => "bob")
|
||||||
Factory(:aspect, :name => "empty", :user => bob)
|
Factory(:aspect, :name => "empty", :user => bob)
|
||||||
|
|
||||||
|
alice.profile.tag_string = '#rockstar'
|
||||||
|
alice.profile.build_tags
|
||||||
|
alice.profile.save!
|
||||||
|
|
||||||
connect_users(bob, bob.aspects.first, alice, alice.aspects.first)
|
connect_users(bob, bob.aspects.first, alice, alice.aspects.first)
|
||||||
connect_users(bob, bob.aspects.first, eve, eve.aspects.first)
|
connect_users(bob, bob.aspects.first, eve, eve.aspects.first)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue