127 lines
2.7 KiB
Ruby
127 lines
2.7 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe "Profile Menu", :js => true, :type => :feature, :capybara_feature => true do
|
|
|
|
subject { page }
|
|
|
|
before(:all) do
|
|
Capybara.javascript_driver = :poltergeist
|
|
Capybara.current_driver = Capybara.javascript_driver
|
|
Capybara.default_wait_time = 10
|
|
end
|
|
|
|
|
|
let(:user) { FactoryGirl.create(:user) }
|
|
|
|
shared_examples_for "Profile Menu Assertions" do |pops_external|
|
|
|
|
describe "Account Home link" do
|
|
|
|
before(:each) do
|
|
click_link 'Account Home'
|
|
end
|
|
|
|
it { should have_selector('h1', text: 'my account') }
|
|
end
|
|
|
|
describe "Identity link" do
|
|
|
|
before(:each) do
|
|
click_link 'Identity'
|
|
end
|
|
|
|
it { should have_selector('h2', text: 'identity:') }
|
|
end
|
|
|
|
describe "Profile link" do
|
|
|
|
before(:each) do
|
|
click_link 'Profile'
|
|
end
|
|
|
|
it { should have_selector('h2', text: 'profile:') }
|
|
end
|
|
|
|
|
|
describe "Audio Gear link" do
|
|
|
|
before(:each) do
|
|
click_link 'Audio Gear'
|
|
end
|
|
|
|
it { should have_selector('h2', text: 'audio profiles:') }
|
|
end
|
|
|
|
describe "Sign Out" do
|
|
|
|
before(:each) do
|
|
click_link 'Sign Out'
|
|
end
|
|
|
|
it { should_be_at_root }
|
|
end
|
|
|
|
describe "Download App link" do
|
|
|
|
before(:each) do
|
|
click_link 'Download App'
|
|
end
|
|
|
|
it {
|
|
# the download app link opens a new window in the client, but not non-client areas of the site
|
|
if pops_external
|
|
page.driver.window_handles.last
|
|
page.within_window page.driver.window_handles.last do
|
|
should have_content('Here are a few of the great things you can do with JamKazam:')
|
|
end
|
|
else
|
|
should have_selector("a.current-os-download")
|
|
end
|
|
}
|
|
end
|
|
|
|
describe "invite submenu" do
|
|
before(:each) do
|
|
click_link "Invite Friends"
|
|
end
|
|
|
|
describe "Email" do
|
|
before(:each) do
|
|
click_link "Email"
|
|
end
|
|
|
|
it {should have_selector('label', text: 'Enter email address(es). If multiple addresses, separate with commas.')}
|
|
end
|
|
end
|
|
end
|
|
|
|
describe "Profile Menu while in Client" do
|
|
before(:each) do
|
|
UserMailer.deliveries.clear
|
|
sign_in_poltergeist user
|
|
visit "/client"
|
|
find('h2', text: 'musicians')
|
|
# open menu
|
|
find('.userinfo').hover()
|
|
end
|
|
|
|
it_behaves_like "Profile Menu Assertions", true
|
|
end
|
|
|
|
describe "Profile Menu while in Web" do
|
|
before(:each) do
|
|
UserMailer.deliveries.clear
|
|
sign_in_poltergeist user
|
|
visit "/downloads"
|
|
find('div.tagline')
|
|
# open menu
|
|
find('.userinfo').hover()
|
|
end
|
|
|
|
it_behaves_like "Profile Menu Assertions", false
|
|
end
|
|
|
|
|
|
|
|
end
|