2014-08-30 17:38:47 +00:00
|
|
|
require 'rails_helper'
|
2013-05-27 20:04:31 +00:00
|
|
|
|
|
|
|
feature "User's profile" do
|
|
|
|
|
|
|
|
let!(:user) { create(:user) }
|
|
|
|
let!(:asciicast) { create(:asciicast, :user => user, :title => 'Tricks!') }
|
|
|
|
|
|
|
|
scenario 'Visiting' do
|
|
|
|
visit profile_path(user)
|
|
|
|
|
2014-02-12 19:51:01 +00:00
|
|
|
expect(page).to have_content(/1 asciicast by #{user.username}/i)
|
2013-05-27 20:04:31 +00:00
|
|
|
expect(page).to have_link('Tricks!')
|
2013-11-18 11:45:16 +00:00
|
|
|
expect(page).to have_selector('.asciicast-list .play-button')
|
2013-05-27 20:04:31 +00:00
|
|
|
end
|
|
|
|
|
2014-03-16 15:03:37 +00:00
|
|
|
scenario 'Updating profile', js: true do
|
|
|
|
login_as user
|
|
|
|
|
|
|
|
within 'header' do
|
|
|
|
click_on user.username
|
|
|
|
click_on 'Settings'
|
|
|
|
end
|
|
|
|
|
|
|
|
fill_in 'Username', with: 'batman'
|
|
|
|
click_on 'Save'
|
|
|
|
|
|
|
|
within 'header' do
|
|
|
|
expect(page).to have_content('batman')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-05-27 20:04:31 +00:00
|
|
|
end
|