Topic: cucumber creating/ and displaying data [SOLVED]
i have a feature that writes a line to the DB and then tries to find it
feature
Scenario: List the locations for my account
Given I am the registered as a user & I am loged in
And I have a location with the address of "123 NE 45 ST"
When I go to a private page Location
Then I should see "123 NE 45 ST"step_definition
Given /^I am the registered user (.+)$/ do |login|
params = {
"username"=> "test_user",
"first_name" => "Test",
"last_name" => "User",
"email"=> "test@email.com",
"password"=>"password",
"password_confirmation"=>"password"
}
@user = User.create!(params)
end
Given /^I have a location with the address of "(.*?)"$/ do |arg1|
params = {
"address"=> "123 NE 45 ST",
"address2" => "",
"city" => "Margate",
"state"=> "Fl",
"zip_code"=>"33308",
"description"=>"HQ",
"account_id"=>@user.id
}
@location = Location.create!(params)
end
When /^I go to a private page Location$/ do
visit locations_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
endERROR
expected there to be content "123 NE 45 ST" in "Locations\n Sign Out\n \n \n\n \n\n // Call template init (optional, but faster if called manually)\n $.template.init();\n\n " (RSpec::Expectations::ExpectationNotMetError)
Last edited by moiseszaragoza (2012-06-18 19:48:11)