Topic: somethng wrong with test cucumber [solved]

for some reason my test are passing when i dont want them to.

example of a test
Feature

Feature: Visitor Page With a list of sites features
  In order to learn more about On-Call Architect
  As a perspective customer
  I want to view company information-

  Scenario Outline: Visit private  pages
    When I go to a private page  <Page>-
    Then I should see be sent back to the home page
    Examples: List of private pages
      | Page        |
      | Location    |
      | Services    |
      | Messages    |
      | Profile     |
                          

step_definitions

When /^I go to a private page  Location$/ do
  visit location_path
end
When /^I go to Home Page$/ do
  visit root_path
end

Last edited by moiseszaragoza (2012-06-13 16:55:58)

Re: somethng wrong with test cucumber [solved]

1. Remove your step_definiton until step 3.
2. Run

Re: somethng wrong with test cucumber [solved]

i think this is what i whant to do

Then /^I should see be sent back to the home page$/ do
  @mypage = request.request_uri
  if (@mypage == root_path)
    pass
  end
end

but i dont think this is legal code

Re: somethng wrong with test cucumber [solved]

i changed my test to to be like

features/visitor_views_site_features.feature

Scenario Outline: Visit private pages and i am not registered to the site-
    When I go to a private page <Page>
    Then I should see "Sign in"
    Examples: List of private pages
      | Page      |
      | Page1    |
      | Page2    |
      | Page3    |

features/step_definitions/visitor_views_site_features.rb

When /^I go to a private page Page$/ do
#  visit page_path
end 

Then /^I should see "(.*?)"$/ do |text|
  if page.respond_to? :should
    page.should have_content(text)
  else
    assert page.has_content?(text)
  end
end