Issues cucumber. refactored step_definitoons

This commit is contained in:
Dmitriy Zaporozhets 2012-08-03 19:49:54 +03:00
parent b846ac1059
commit 1281c122c7
14 changed files with 115 additions and 206 deletions

View file

@ -0,0 +1,34 @@
Given /^I visit profile keys page$/ do
visit keys_path
end
Then /^I should see my ssh keys$/ do
@user.keys.each do |key|
page.should have_content(key.title)
end
end
Given /^I have ssh keys:$/ do |table|
table.hashes.each do |row|
Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}"
end
end
Given /^I submit new ssh key "(.*?)"$/ do |arg1|
fill_in "key_title", :with => arg1
fill_in "key_key", :with => "publickey234="
click_button "Save"
end
Then /^I should see new ssh key "(.*?)"$/ do |arg1|
key = Key.find_by_title(arg1)
page.should have_content(key.title)
page.should have_content(key.key)
current_path.should == key_path(key)
end
Then /^I should not see "(.*?)" ssh key$/ do |arg1|
within "#keys-table" do
page.should_not have_content(arg1)
end
end

View file

@ -0,0 +1,51 @@
Given /^I visit profile page$/ do
visit profile_path
end
Then /^I should see my profile info$/ do
page.should have_content "Profile"
page.should have_content @user.name
page.should have_content @user.email
end
Given /^I visit profile password page$/ do
visit profile_password_path
end
Then /^I change my password$/ do
fill_in "user_password", :with => "222333"
fill_in "user_password_confirmation", :with => "222333"
click_button "Save"
end
Then /^I should be redirected to sign in page$/ do
current_path.should == new_user_session_path
end
Given /^I visit profile token page$/ do
visit profile_token_path
end
Then /^I reset my token$/ do
@old_token = @user.private_token
click_button "Reset"
end
Then /^I should see new token$/ do
find("#token").value.should_not == @old_token
find("#token").value.should == @user.reload.private_token
end
Then /^I change my contact info$/ do
fill_in "user_skype", :with => "testskype"
fill_in "user_linkedin", :with => "testlinkedin"
fill_in "user_twitter", :with => "testtwitter"
click_button "Save"
@user.reload
end
Then /^I should see new contact info$/ do
@user.skype.should == 'testskype'
@user.linkedin.should == 'testlinkedin'
@user.twitter.should == 'testtwitter'
end