Skip to content
Snippets Groups Projects
Commit 7aeb92b8 authored by Nihad Abbasov's avatar Nihad Abbasov
Browse files

rewrite profile feature steps using spinach

parent d74f5473
No related branches found
No related tags found
1 merge request!1426Cucumber => Spinach
Feature: Profile
Background:
Given I signin as a user
Background:
Given I sign in as a user
 
Scenario: I look at my profile
Given I visit profile page
Loading
Loading
Feature: SSH Keys
Background:
Given I signin as a user
And I have ssh keys:
| title |
| ssh-rsa Work |
| ssh-rsa Home |
Feature: Profile SSH Keys
Background:
Given I sign in as a user
And I have ssh key "ssh-rsa Work"
And I visit profile keys page
 
Scenario: I should see SSH keys
Scenario: I should see ssh keys
Then I should see my ssh keys
 
Scenario: Add new ssh key
Loading
Loading
class Profile < Spinach::FeatureSteps
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
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
And 'I should see new contact info' do
@user.skype.should == 'testskype'
@user.linkedin.should == 'testlinkedin'
@user.twitter.should == 'testtwitter'
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
And '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
And 'I should see new token' do
find("#token").value.should_not == @old_token
find("#token").value.should == @user.reload.private_token
end
Given 'I sign in as a user' do
login_as :user
end
end
class ProfileSshKeys < Spinach::FeatureSteps
Then 'I should see my ssh keys' do
@user.keys.each do |key|
page.should have_content(key.title)
end
end
Given 'I click link "Add new"' do
click_link "Add new"
end
And 'I submit new ssh key "Laptop"' do
fill_in "key_title", :with => "Laptop"
fill_in "key_key", :with => "ssh-rsa publickey234="
click_button "Save"
end
Then 'I should see new ssh key "Laptop"' do
key = Key.find_by_title("Laptop")
page.should have_content(key.title)
page.should have_content(key.key)
current_path.should == key_path(key)
end
Given 'I click link "Work"' do
click_link "Work"
end
And 'I click link "Remove"' do
click_link "Remove"
end
Then 'I visit profile keys page' do
visit keys_path
end
And 'I should not see "Work" ssh key' do
within "#keys-table" do
page.should_not have_content "Work"
end
end
Given 'I sign in as a user' do
login_as :user
end
And 'I have ssh key "ssh-rsa Work"' do
Factory :key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work"
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment