Skip to content

Commit

Permalink
Merge remote-tracking branch 'rcganesh/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennifer Smith committed May 8, 2012
2 parents c1864cd + 1b4d8b1 commit 16ee9bc
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 9 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 3 additions & 7 deletions capybara_features/step_definitions/database_steps.rb
Expand Up @@ -14,14 +14,10 @@
Given %(a #{user_type} "#{user_name}" with password "123")
end

Given /^I am logged in as "(.+)"/ do |user_name|
@session = Session.for_user(User.find_by_user_name(user_name), nil)
@session.save!
@session.put_in_cookie cookies
end

Given /^I have an expired session/ do
@session.destroy
Session.all.each do |session|
session.destroy
end
end

Given /^user "(.+)" is disabled$/ do |username|
Expand Down
6 changes: 6 additions & 0 deletions capybara_features/step_definitions/login_steps.rb
Expand Up @@ -14,6 +14,12 @@
Given "I press \"Log in\""
end

Given /^I am logged in as "(.+)"/ do |user_name|
Given "I am on the login page"
Given "I fill in \"#{user_name}\" for \"user_name\""
Given "I fill in \"123\" for \"password\""
Given "I press \"Log in\""
end


Given /there is a User/ do
Expand Down
13 changes: 13 additions & 0 deletions capybara_features/step_definitions/more_web_steps.rb
Expand Up @@ -65,3 +65,16 @@ def with_scope(locator)
Then /^the field "([^"]*)" should have the following options:$/ do |locator, table|
page.should have_select(locator, :options => table.raw.flatten)
end

Then /^(?:|I )should see a link to the (.+)$/ do |page_name|
page.find(:xpath, "//a[@href=\"#{path_to(page_name)}\"] ")
end

Then /^I should not be able to see (.+)$/ do |page_name|
lambda { visit path_to(page_name) }.should raise_error(AuthorizationFailure)
end

Then /^I should be able to see (.+)$/ do |page_name|
When "I go to #{page_name}"
Then "I should be on #{page_name}"
end
2 changes: 1 addition & 1 deletion capybara_features/step_definitions/web_steps.rb
Expand Up @@ -9,7 +9,7 @@

module WithinHelpers
def with_scope(locator)
locator ? within(locator) { yield } : yield
locator ? within(:css, locator) { yield } : yield
end
end
World(WithinHelpers)
Expand Down
Expand Up @@ -6,6 +6,5 @@ Feature: Only users should be allowed to access the system
Given "Lawrence" is the user
And I am logged in as "Lawrence"
And I have an expired session

When I go to the home page
And I should see "invalid session token"

0 comments on commit 16ee9bc

Please sign in to comment.