Permalink
Browse files

Update syntax for compatibility with latest selectors

  • Loading branch information...
1 parent 4b7c60f commit 6e50bffead8dd3ff0f55011e2788ec08f131a412 @sferik sferik committed Jul 16, 2011
View
1 features/dashboard.feature
@@ -25,4 +25,3 @@ Feature: Dashboard
And I should see "x86-mswin32"
And I should see "1,001 downloads"
And I should see "1,008 downloads"
-
View
2 features/download.feature
@@ -29,7 +29,7 @@ Feature: Download Gems
When I follow "1.0.0"
Then I should see "5 total downloads"
And I should see "2 for this version"
-
+
When I download the rubygem "sandworm" version "2.0.0" 1000 times
And the system processes jobs
And I visit the gem page for "sandworm"
View
2 features/gems_api.feature
@@ -9,4 +9,4 @@ Feature: List gems API
And a rubygem exists with name "MyGem" and version "1.0.0"
And the "MyGem" rubygem is owned by "original@owner.org"
When I list the gems with my api key
- Then I should see "MyGem"
+ Then I should see "MyGem"
View
4 features/gravatar.feature
@@ -5,11 +5,11 @@ Feature: Gravatar
Scenario: User is not signed in
Given no user exists with an email of "email@person.com"
- When I go to the homepage
+ When I request "/"
Then I should not see my gravatar
Scenario: User is signed in
Given I am using HTTPS
And I have signed in with "email@person.com/password"
- When I go to the homepage
+ When I request "/"
Then I should see my gravatar
View
8 features/search.feature
@@ -1,6 +1,6 @@
Feature: Search
In order to find a gem I want
- As a ruby developer
+ As a ruby developer
I should be able to search for gems on gemcutter
Scenario: Search Titles
@@ -11,7 +11,7 @@ Feature: Search
And a version exists for the "mongrel" rubygem with a description of "web server"
And a version exists for the "thin" rubygem with a description of "web server"
When I go to the homepage
- And I fill in "query" with "mon"
+ And I fill in "query" with "mon"
And I press "Search"
Then I should see "mongrel"
@@ -23,7 +23,7 @@ Feature: Search
And a version exists for the "twitter" rubygem with a description of "social junk"
And a version exists for the "beer_laser" rubygem with a description of "amazing beer"
When I go to the homepage
- And I fill in "query" with "beer"
+ And I fill in "query" with "beer"
And I press "Search"
Then I should see "beer_laser"
@@ -58,7 +58,7 @@ Feature: Search
And I fill in "query" with "paperclip"
And I press "Search"
Then I should see "Exact match"
-
+
Scenario: Exact match not found
Given a rubygem exists with a name of "foos-paperclip"
And a rubygem exists with a name of "bars-paperclip"
View
1 features/sign_out.feature
@@ -13,4 +13,3 @@ Feature: Sign out
And I should be signed out
When I return next time
Then I should be signed out
-
View
1 features/sign_up.feature
@@ -60,4 +60,3 @@ Feature: Sign up
And I follow the confirmation link sent to "email@person.com"
Then I should see "Already confirmed email. Please sign in."
And I should be signed out
-
View
45 features/step_definitions/api_steps.rb
@@ -1,8 +1,8 @@
Given /^I have an api key for "([^\"]*)"$/ do |creds|
user, pass = creds.split('/')
- basic_auth(user, pass)
- visit api_v1_api_key_path, :get
- @api_key = response.body
+ page.driver.browser.basic_authorize(user, pass)
+ get api_v1_api_key_path
+ @api_key = page.body
end
Given /^I've already pushed the gem "([^\"]*)" with my api key$/ do |name| # '
@@ -11,78 +11,75 @@
When /^I push the gem "([^\"]*)" with my api key$/ do |name|
api_key_header
-
path = File.join(TEST_DIR, name)
- visit api_v1_rubygems_path, :post, File.open(path).read
+ post api_v1_rubygems_path, File.open(path).read
end
When 'I push an invalid .gem file' do
api_key_header
- visit api_v1_rubygems_path, :post, 'ZZZZZZZZZZZZZZZZZZ'
+ post api_v1_rubygems_path, 'ZZZZZZZZZZZZZZZZZZ'
end
When /^I yank the gem "([^\"]*)" version "([^\"]*)" with my api key$/ do |name, version_number|
header("HTTP_AUTHORIZATION", @api_key)
- visit yank_api_v1_rubygems_path(:gem_name => name, :version => version_number), :delete
- assert_match /Successfully yanked gem: #{name} \(#{version_number}\)/, response.body
+ delete yank_api_v1_rubygems_path(:gem_name => name, :version => version_number)
+ assert_match /Successfully yanked gem: #{name} \(#{version_number}\)/, page.body
end
When /^I attempt to yank the gem "([^\"]*)" version "([^\"]*)" with my api key$/ do |name, version_number|
header("HTTP_AUTHORIZATION", @api_key)
- visit yank_api_v1_rubygems_path(:gem_name => name, :version => version_number), :delete
+ delete yank_api_v1_rubygems_path(:gem_name => name, :version => version_number)
end
When /^I unyank the gem "([^\"]*)" version "([^\"]*)" with my api key$/ do |name, version_number|
header("HTTP_AUTHORIZATION", @api_key)
- visit unyank_api_v1_rubygems_path(:gem_name => name, :version => version_number), :put
- assert_match /Successfully unyanked gem: #{name} \(#{version_number}\)/, response.body
+ put unyank_api_v1_rubygems_path(:gem_name => name, :version => version_number)
+ assert_match /Successfully unyanked gem: #{name} \(#{version_number}\)/, page.body
end
When /^I migrate the gem "([^\"]*)" with my api key$/ do |name|
rubygem = Rubygem.find_by_name!(name)
-
header("HTTP_AUTHORIZATION", @api_key)
- visit migrate_path(:rubygem_id => rubygem.to_param), :post
- token = response.body
-
+ post migrate_path(:rubygem_id => rubygem.to_param)
+ token = page.body
subdomain = rubygem.versions.latest.rubyforge_project
- WebMock.stub_request(:get, "http://#{subdomain}.rubyforge.org/migrate-#{name}.html")
+ WebMock.stub_request(:put, "http://#{subdomain}.rubyforge.org/migrate-#{name}.html")
- visit migrate_path(:rubygem_id => rubygem.to_param), :put
+ put migrate_path(:rubygem_id => rubygem.to_param)
end
When /^I list the owners of gem "([^\"]*)" with my api key$/ do |name|
api_key_header
- visit api_v1_rubygem_owners_path(:rubygem_id => name), :get
+ get api_v1_rubygem_owners_path(:rubygem_id => name)
end
When /^I list the owners of gem "([^\"]*)" as "([^"]+)" with my api key$/ do |name, format|
api_key_header
- visit "#{api_v1_rubygem_owners_path(name)}.#{format}", :get
+ get "#{api_v1_rubygem_owners_path(name)}.#{format}"
end
When /^I add the owner "([^\"]*)" to the rubygem "([^\"]*)" with my api key$/ do |owner_email, rubygem_name|
api_key_header
- visit api_v1_rubygem_owners_path(:rubygem_id => rubygem_name), :post, :email => owner_email
+ post api_v1_rubygem_owners_path(:rubygem_id => rubygem_name), :email => owner_email
end
When /^I remove the owner "([^\"]*)" from the rubygem "([^\"]*)" with my api key$/ do |owner_email, rubygem_name|
api_key_header
- visit api_v1_rubygem_owners_path(:rubygem_id => rubygem_name), :delete, :email => owner_email
+ delete api_v1_rubygem_owners_path(:rubygem_id => rubygem_name), :email => owner_email
end
When /^I download the rubygem "([^\"]*)" version "([^\"]*)" (\d+) times?$/ do |rubygem_name, version_number, count|
count.to_i.times do
- visit "/gems/#{rubygem_name}-#{version_number}.gem", :get
+ get "/gems/#{rubygem_name}-#{version_number}.gem"
end
end
When 'I request "$url"' do |url|
- visit url
+ get url
end
When 'I list the gems with my api key' do
api_key_header
- visit api_v1_rubygems_path, :get
+ get api_v1_rubygems_path
end
View
14 features/step_definitions/clearance_steps.rb
@@ -1,7 +1,7 @@
# General
Then /^I should see error messages$/ do
- assert_match /error(s)? prohibited/m, response.body
+ assert_match /error(s)? prohibited/m, page.body
end
# Database
@@ -65,8 +65,7 @@
When /^I follow the confirmation link sent to "(.*)"$/ do |email|
user = User.find_by_email(email)
- visit new_user_confirmation_path(:user_id => user,
- :token => user.confirmation_token)
+ get new_user_confirmation_path(:user_id => user, :token => user.confirmation_token)
end
Then /^a password reset message should be sent to "(.*)"$/ do |email|
@@ -80,13 +79,12 @@
When /^I follow the password reset link sent to "(.*)"$/ do |email|
user = User.find_by_email(email)
- visit edit_user_password_path(:user_id => user,
- :token => user.confirmation_token)
+ get edit_user_password_path(:user_id => user, :token => user.confirmation_token)
end
When /^I try to change the password of "(.*)" without token$/ do |email|
user = User.find_by_email(email)
- visit edit_user_password_path(:user_id => user)
+ get edit_user_password_path(:user_id => user)
end
Then /^I should be forbidden$/ do
@@ -99,11 +97,11 @@
When %{I go to the sign in page}
And %{I fill in "Email" with "#{email}"}
And %{I fill in "Password" with "#{password}"}
- And %{I press "Sign In"}
+ And %{I press "Sign in"}
end
When /^I sign out$/ do
- visit '/session', :delete
+ delete '/session'
end
When /^I request password reset link to be sent to "(.*)"$/ do |email|
View
7 features/step_definitions/dependency_steps.rb
@@ -3,16 +3,15 @@
version = Version.find_by_full_name!(hash['Version'])
rubygem = Factory(:rubygem, :name => hash['Rubygem'])
gem_dependency = Gem::Dependency.new(rubygem.name, hash['Requirements'])
-
Factory(:dependency, :version => version, :rubygem => rubygem, :gem_dependency => gem_dependency)
end
end
When /^I request dependencies with (\d+) gems$/ do |count|
- gems = count.to_i.times.map { |n| "zergling#{n}" }.join(",")
- visit "/api/v1/dependencies?gems=#{gems}"
+ gems = count.to_i.times.map{|n| "zergling#{n}"}.join(",")
+ get "/api/v1/dependencies?gems=#{gems}"
end
Then /^I see status code (\d+)$/ do |code|
- assert_equal code, response.code
+ assert_equal code, page.code
end
View
1 features/step_definitions/gravatar_steps.rb
@@ -5,4 +5,3 @@
Then /^I should see my gravatar$/ do
assert_have_selector('#user_gravatar')
end
-
View
4 features/step_definitions/user_steps.rb
@@ -4,10 +4,10 @@
new_value = @me.reload.send(attribute)
assert_not_equal previous_value, new_value,
"New value for #{humanized_attribute} expected but it hasn't changed!"
- assert_match new_value, response.body
+ assert_match new_value, page.body
end
Then /^I should see my "(.*)"$/ do |humanized_attribute|
attribute = humanized_attribute.downcase.gsub(/\s/, '_')
- assert_match @me.send(attribute), response.body
+ assert_match @me.send(attribute), page.body
end
View
6 features/step_definitions/view_steps.rb
@@ -1,16 +1,16 @@
When /^I visit the gem page for "([^\"]*)"$/ do |gem_name|
rubygem = Rubygem.find_by_name!(gem_name)
- visit rubygem_path(rubygem)
+ get rubygem_path(rubygem)
end
When /^I visit the gem page for "([^\"]*)" version "([^\"]*)"$/ do |gem_name, version_number|
rubygem = Rubygem.find_by_name!(gem_name)
- visit rubygem_version_path(rubygem, version_number)
+ get rubygem_version_path(rubygem, version_number)
end
And /^I save and open the page$/ do
save_and_open_page
- print @response.body
+ print page.body
end
Then /^I should see the following most recent downloads:$/ do |table|
View
35 features/step_definitions/webhook_steps.rb
@@ -1,21 +1,20 @@
When /^I have added a webhook for "([^\"]*)" to gem "([^\"]*)" with my api key$/ do |web_hook_url, gem_name|
api_key_header
WebMock.stub_request(:post, web_hook_url)
- visit api_v1_web_hooks_path, :post, :gem_name => gem_name, :url => web_hook_url
+ post api_v1_web_hooks_path, :gem_name => gem_name, :url => web_hook_url
end
When /^I have added a global webhook for "([^\"]*)" with my api key$/ do |web_hook_url|
api_key_header
WebMock.stub_request(:post, web_hook_url)
- visit api_v1_web_hooks_path,
- :post,
- :gem_name => WebHook::GLOBAL_PATTERN,
- :url => web_hook_url
+ post api_v1_web_hooks_path,
+ :gem_name => WebHook::GLOBAL_PATTERN,
+ :url => web_hook_url
end
When /I list the webhooks as (json|yaml) with my api key/ do |format|
api_key_header
- visit api_v1_web_hooks_path, :get, :format => format
+ get api_v1_web_hooks_path(:format => format)
end
Then /^the webhook "([^\"]*)" should receive a POST with gem "([^\"]*)" at version "([^\"]*)"$/ do |web_hook_url, gem_name, version_number|
@@ -30,9 +29,9 @@
Then /I should see "(.*)" under "(.*)" in (json|yaml)/ do |web_hook_url, gem_name, format|
if format == "json"
- data = ActiveSupport::JSON.decode(response.body)
+ data = ActiveSupport::JSON.decode(page.body)
else
- data = YAML.load(response.body)
+ data = YAML.load(page.body)
end
assert data[gem_name]
@@ -41,34 +40,30 @@
When /^I have removed a webhook for "([^\"]*)" from gem "([^\"]*)" with my api key$/ do |web_hook_url, gem_name|
api_key_header
- visit remove_api_v1_web_hooks_path,
- :delete,
+ delete remove_api_v1_web_hooks_path,
:gem_name => gem_name,
:url => web_hook_url
end
When /^I have removed the global webhook for "([^\"]*)"$/ do |web_hook_url|
api_key_header
- visit remove_api_v1_web_hooks_path,
- :delete,
+ delete remove_api_v1_web_hooks_path,
:gem_name => WebHook::GLOBAL_PATTERN,
:url => web_hook_url
end
When /^I have fired a webhook to "([^\"]*)" for the "([^\"]*)" gem with my api key$/ do |web_hook_url, gem_name|
api_key_header
- visit fire_api_v1_web_hooks_path,
- :post,
- :gem_name => gem_name,
- :url => web_hook_url
+ post fire_api_v1_web_hooks_path,
+ :gem_name => gem_name,
+ :url => web_hook_url
end
When /^I have fired a webhook to "([^\"]*)" for all gems with my api key$/ do |web_hook_url|
api_key_header
- visit fire_api_v1_web_hooks_path,
- :post,
- :gem_name => WebHook::GLOBAL_PATTERN,
- :url => web_hook_url
+ post fire_api_v1_web_hooks_path,
+ :gem_name => WebHook::GLOBAL_PATTERN,
+ :url => web_hook_url
end
Then /^the webhook "([^\"]*)" should not receive a POST$/ do |web_hook_url|

0 comments on commit 6e50bff

Please sign in to comment.