* VRFS-790; removing database cleaner before every test to fix alter table collisions, as well as speed up tests
This commit is contained in:
parent
00308c2c73
commit
ed2303b916
|
|
@ -88,7 +88,6 @@ end
|
|||
gem 'capybara-screenshot'
|
||||
gem 'cucumber-rails', :require => false #, '1.3.0', :require => false
|
||||
gem 'factory_girl_rails', '4.1.0'
|
||||
gem 'database_cleaner', '0.7.0'
|
||||
gem 'guard-spork', '0.3.2'
|
||||
gem 'spork', '0.9.0'
|
||||
gem 'launchy', '2.1.0'
|
||||
|
|
|
|||
|
|
@ -43,8 +43,10 @@ describe "Account", :js => true, :type => :feature, :capybara_feature => true do
|
|||
|
||||
end
|
||||
|
||||
it { should have_selector('h1', text: 'my account') }
|
||||
it { should have_selector('#notification h2', text: 'Confirmation Email Sent') }
|
||||
it {
|
||||
should have_selector('h1', text: 'my account');
|
||||
should have_selector('#notification h2', text: 'Confirmation Email Sent')
|
||||
}
|
||||
end
|
||||
|
||||
describe "update password" do
|
||||
|
|
@ -67,10 +69,12 @@ describe "Account", :js => true, :type => :feature, :capybara_feature => true do
|
|||
find("#account-edit-password-submit").trigger(:click)
|
||||
end
|
||||
|
||||
it { should have_selector('h2', text: 'identity:') }
|
||||
it { should have_selector('div.field.error input[name=current_password] ~ ul li', text: "can't be blank") }
|
||||
it { should have_selector('div.field.error input[name=password] ~ ul li', text: "is too short (minimum is 6 characters)") }
|
||||
it { should have_selector('div.field.error input[name=password_confirmation] ~ ul li', text: "can't be blank") }
|
||||
it {
|
||||
should have_selector('h2', text: 'identity:')
|
||||
should have_selector('div.field.error input[name=current_password] ~ ul li', text: "can't be blank")
|
||||
should have_selector('div.field.error input[name=password] ~ ul li', text: "is too short (minimum is 6 characters)")
|
||||
should have_selector('div.field.error input[name=password_confirmation] ~ ul li', text: "can't be blank")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -89,8 +93,10 @@ describe "Account", :js => true, :type => :feature, :capybara_feature => true do
|
|||
find("#account-edit-profile-submit").trigger(:click)
|
||||
end
|
||||
|
||||
it { should have_selector('h1', text: 'my account') }
|
||||
it { should have_selector('#notification h2', text: 'Profile Changed') }
|
||||
it {
|
||||
should have_selector('h1', text: 'my account')
|
||||
should have_selector('#notification h2', text: 'Profile Changed')
|
||||
}
|
||||
end
|
||||
|
||||
describe "unsuccessfully" do
|
||||
|
|
@ -101,9 +107,11 @@ describe "Account", :js => true, :type => :feature, :capybara_feature => true do
|
|||
find("#account-edit-profile-submit").trigger(:click)
|
||||
end
|
||||
|
||||
it { should have_selector('h2', text: 'profile:') }
|
||||
it { should have_selector('div.field.error input[name=first_name] ~ ul li', text: "can't be blank") }
|
||||
it { should have_selector('div.field.error input[name=last_name] ~ ul li', text: "can't be blank") }
|
||||
it {
|
||||
should have_selector('h2', text: 'profile:')
|
||||
should have_selector('div.field.error input[name=first_name] ~ ul li', text: "can't be blank")
|
||||
should have_selector('div.field.error input[name=last_name] ~ ul li', text: "can't be blank")
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@ describe "Find Session", :js => true, :type => :feature, :capybara_feature => tr
|
|||
# when no sessions have been created:
|
||||
it "shows there are no sessions" do
|
||||
|
||||
MusicSession.delete_all
|
||||
|
||||
sign_in_poltergeist user
|
||||
visit "/#/findSession"
|
||||
# sleep 10
|
||||
|
||||
# verify no sessions are found
|
||||
expect(page).to have_selector('#sessions-none-found')
|
||||
|
|
@ -46,8 +47,6 @@ describe "Find Session", :js => true, :type => :feature, :capybara_feature => tr
|
|||
click_link('btn-create-session') # fails if page width is low
|
||||
end
|
||||
|
||||
# sleep 10
|
||||
|
||||
# verify that the in-session page is showing
|
||||
expect(page).to have_selector('h2', text: 'my tracks')
|
||||
end
|
||||
|
|
@ -56,8 +55,6 @@ describe "Find Session", :js => true, :type => :feature, :capybara_feature => tr
|
|||
in_client(:two) do
|
||||
sign_in_poltergeist finder
|
||||
visit "/#/findSession"
|
||||
# sleep 10
|
||||
puts finder.email + " attempting to see session of " + user.email
|
||||
|
||||
# verify the session description is seen by second client
|
||||
expect(page).to have_text(@unique_session_desc)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
before do
|
||||
fill_in "jam_ruby_user[first_name]", with: "Mike"
|
||||
fill_in "jam_ruby_user[last_name]", with: "Jones"
|
||||
fill_in "jam_ruby_user[email]", with: "noone@jamkazam.com"
|
||||
fill_in "jam_ruby_user[email]", with: "newuser1@jamkazam.com"
|
||||
fill_in "jam_ruby_user[password]", with: "jam123"
|
||||
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
|
||||
check("jam_ruby_user[instruments][drums][selected]")
|
||||
|
|
@ -27,25 +27,29 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
end
|
||||
|
||||
# Successful signup with no invitation tells you to go sign up
|
||||
it { page.should have_title("JamKazam | Congratulations") }
|
||||
it { should have_content("You have successfully registered as a JamKazam musician.") }
|
||||
it { User.find_by_email('noone@jamkazam.com').musician_instruments.length.should == 1 }
|
||||
# an email is sent on no-invite signup
|
||||
it { UserMailer.deliveries.length.should == 1 }
|
||||
it { UserMailer.deliveries[0].html_part.body.include?("To confirm this email address")== 1 }
|
||||
it {uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')}
|
||||
it {
|
||||
should have_title("JamKazam | Congratulations")
|
||||
should have_content("You have successfully registered as a JamKazam musician.")
|
||||
User.find_by_email('newuser1@jamkazam.com').musician_instruments.length.should == 1
|
||||
# an email is sent on no-invite signup
|
||||
UserMailer.deliveries.length.should == 1
|
||||
UserMailer.deliveries[0].html_part.body.include?("To confirm this email address")== 1
|
||||
uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')
|
||||
}
|
||||
|
||||
describe "user can confirm email and receive welcome email" do
|
||||
|
||||
before(:each) do
|
||||
UserMailer.deliveries.clear
|
||||
visit signup_confirm_path(User.find_by_email('noone@jamkazam.com').signup_token)
|
||||
visit signup_confirm_path(User.find_by_email('newuser1@jamkazam.com').signup_token)
|
||||
end
|
||||
|
||||
it { page.should have_title("JamKazam") }
|
||||
it { should have_selector('h2', text: "musicians") }
|
||||
it { UserMailer.deliveries.length.should == 1 }
|
||||
it { UserMailer.deliveries[0].html_part.body.include?("Following are links to some resources")== 1 }
|
||||
it {
|
||||
should have_title("JamKazam")
|
||||
should have_selector('h2', text: "musicians")
|
||||
UserMailer.deliveries.length.should == 1
|
||||
UserMailer.deliveries[0].html_part.body.include?("Following are links to some resources")== 1
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -63,13 +67,16 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
end
|
||||
|
||||
# Successful signup with no invitation tells you to go sign up
|
||||
it { page.should have_title("JamKazam | Congratulations") }
|
||||
it { should have_selector('div.tagline', text: "Congratulations!") }
|
||||
it { should have_selector('a.button-orange.m0', text: 'PROCEED TO JAMKAZAM SITE') }
|
||||
it { User.find_by_email('somefan@jamkazam.com').musician_instruments.length.should == 0 }
|
||||
# an email is sent on no-invite signup
|
||||
it { UserMailer.deliveries.length.should == 1 }
|
||||
it {uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_fan_path(:type => 'Native')}
|
||||
it {
|
||||
should have_title("JamKazam | Congratulations")
|
||||
should have_selector('div.tagline', text: "Congratulations!")
|
||||
should have_selector('a.button-orange.m0', text: 'PROCEED TO JAMKAZAM SITE')
|
||||
User.find_by_email('somefan@jamkazam.com').musician_instruments.length.should == 0
|
||||
# an email is sent on no-invite signup
|
||||
UserMailer.deliveries.length.should == 1
|
||||
uri = URI.parse(current_url)
|
||||
"#{uri.path}?#{uri.query}".should == congratulations_fan_path(:type => 'Native')
|
||||
}
|
||||
end
|
||||
|
||||
describe "with service invite" do
|
||||
|
|
@ -80,7 +87,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
UserMailer.deliveries.clear
|
||||
fill_in "jam_ruby_user[first_name]", with: "Mike"
|
||||
fill_in "jam_ruby_user[last_name]", with: "Jones"
|
||||
fill_in "jam_ruby_user[email]", with: "noone@jamkazam.com"
|
||||
fill_in "jam_ruby_user[email]", with: "newuser2@jamkazam.com"
|
||||
fill_in "jam_ruby_user[password]", with: "jam123"
|
||||
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
|
||||
check("jam_ruby_user[instruments][drums][selected]")
|
||||
|
|
@ -89,11 +96,13 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
end
|
||||
|
||||
# Successful sign-in goes to the client
|
||||
it { page.should have_title("JamKazam") }
|
||||
it { should have_selector('div.tagline', text: "Congratulations!") }
|
||||
|
||||
it { UserMailer.deliveries.length.should == 1 }
|
||||
it {uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')}
|
||||
it {
|
||||
should have_title("JamKazam")
|
||||
should have_selector('div.tagline', text: "Congratulations!")
|
||||
UserMailer.deliveries.length.should == 1
|
||||
uri = URI.parse(current_url)
|
||||
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')
|
||||
}
|
||||
end
|
||||
|
||||
describe "with user invite and autofriend" do
|
||||
|
|
@ -104,7 +113,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
|
||||
fill_in "jam_ruby_user[first_name]", with: "Mike"
|
||||
fill_in "jam_ruby_user[last_name]", with: "Jones"
|
||||
fill_in "jam_ruby_user[email]", with: "noone@jamkazam.com"
|
||||
fill_in "jam_ruby_user[email]", with: "newuser3@jamkazam.com"
|
||||
fill_in "jam_ruby_user[password]", with: "jam123"
|
||||
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
|
||||
check("jam_ruby_user[instruments][drums][selected]")
|
||||
|
|
@ -113,11 +122,14 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
end
|
||||
|
||||
# Successful sign-in goes to the client
|
||||
it { page.should have_title("JamKazam") }
|
||||
it { should have_selector('div.tagline', text: "Congratulations!") }
|
||||
it { @user.friends?(User.find_by_email("noone@jamkazam.com")) }
|
||||
it { User.find_by_email("noone@jamkazam.com").friends?(@user) }
|
||||
it {uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')}
|
||||
it {
|
||||
should have_title("JamKazam")
|
||||
should have_selector('div.tagline', text: "Congratulations!")
|
||||
@user.friends?(User.find_by_email("newuser3@jamkazam.com"))
|
||||
User.find_by_email("newuser3@jamkazam.com").friends?(@user)
|
||||
uri = URI.parse(current_url)
|
||||
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')
|
||||
}
|
||||
end
|
||||
|
||||
describe "can't signup to the same invite twice" do
|
||||
|
|
@ -127,7 +139,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
|
||||
fill_in "jam_ruby_user[first_name]", with: "Mike"
|
||||
fill_in "jam_ruby_user[last_name]", with: "Jones"
|
||||
fill_in "jam_ruby_user[email]", with: "noone@jamkazam.com"
|
||||
fill_in "jam_ruby_user[email]", with: "newuser4@jamkazam.com"
|
||||
fill_in "jam_ruby_user[password]", with: "jam123"
|
||||
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
|
||||
check("jam_ruby_user[instruments][drums][selected]")
|
||||
|
|
@ -151,7 +163,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
|
||||
fill_in "jam_ruby_user[first_name]", with: "Mike"
|
||||
fill_in "jam_ruby_user[last_name]", with: "Jones"
|
||||
fill_in "jam_ruby_user[email]", with: "noone@jamkazam.com"
|
||||
fill_in "jam_ruby_user[email]", with: "newuser5@jamkazam.com"
|
||||
fill_in "jam_ruby_user[password]", with: "jam123"
|
||||
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
|
||||
check("jam_ruby_user[instruments][drums][selected]")
|
||||
|
|
@ -159,14 +171,15 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
click_button "CREATE ACCOUNT"
|
||||
end
|
||||
|
||||
it { page.should have_title("JamKazam | Congratulations") }
|
||||
it { should have_content("You have successfully registered as a JamKazam musician.") }
|
||||
it { User.find_by_email('noone@jamkazam.com').musician_instruments.length.should == 1 }
|
||||
it { User.find_by_email('what@jamkazam.com').should be_nil }
|
||||
# an email is sent when you invite but use a different email than the one used to invite
|
||||
it { UserMailer.deliveries.length.should == 1 }
|
||||
it {uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')}
|
||||
it {
|
||||
should have_title("JamKazam | Congratulations")
|
||||
should have_content("You have successfully registered as a JamKazam musician.")
|
||||
User.find_by_email('newuser5@jamkazam.com').musician_instruments.length.should == 1
|
||||
User.find_by_email('what@jamkazam.com').should be_nil
|
||||
# an email is sent when you invite but use a different email than the one used to invite
|
||||
UserMailer.deliveries.length.should == 1
|
||||
uri = URI.parse(current_url)
|
||||
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')
|
||||
visit "#{signup_path}?invitation_code=#{@invited_user.invitation_code}"
|
||||
should have_selector('h1', text: "You have already signed up with this invitation")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ describe "User Progression", :js => true, :type => :feature, :capybara_feature
|
|||
visit signup_path
|
||||
fill_in "jam_ruby_user[first_name]", with: "Mike"
|
||||
fill_in "jam_ruby_user[last_name]", with: "Jones"
|
||||
fill_in "jam_ruby_user[email]", with: "noone@jamkazam.com"
|
||||
fill_in "jam_ruby_user[email]", with: "user_progression1@jamkazam.com"
|
||||
fill_in "jam_ruby_user[password]", with: "jam123"
|
||||
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
|
||||
check("jam_ruby_user[instruments][drums][selected]")
|
||||
|
|
@ -44,8 +44,8 @@ describe "User Progression", :js => true, :type => :feature, :capybara_feature
|
|||
end
|
||||
|
||||
it {
|
||||
User.find_by_email('noone@jamkazam.com').reload();
|
||||
User.find_by_email('noone@jamkazam.com').first_downloaded_client_at.should_not be_nil
|
||||
User.find_by_email('user_progression1@jamkazam.com').reload();
|
||||
User.find_by_email('user_progression1@jamkazam.com').first_downloaded_client_at.should_not be_nil
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ describe MusicSessionManager do
|
|||
it "creates a session properly" do
|
||||
music_session = @music_session_manager.create(@user, @connection.client_id, "description", true, false, true, true, @band, [@genre], @tracks, true)
|
||||
|
||||
MusicSession.count.should == 1
|
||||
MusicSession.first.id.should == music_session.id
|
||||
MusicSession.find(music_session.id) # shouldn't throw an exception
|
||||
end
|
||||
|
||||
it "updates a session properly" do
|
||||
|
|
@ -41,10 +40,11 @@ describe MusicSessionManager do
|
|||
|
||||
it "deletes a session properly" do
|
||||
music_session = @music_session_manager.create(@user, @connection.client_id, "description", true, false, true, true, @band, [@genre], @tracks, true)
|
||||
MusicSessionHistory.count.should == 1
|
||||
MusicSessionHistory.first.music_session_id.should == music_session.id
|
||||
music_session_user_history = MusicSessionHistory.find_by_music_session_id(music_session.id)
|
||||
music_session_user_history.should_not be_nil
|
||||
music_session.destroy
|
||||
MusicSessionHistory.first.session_removed_at.should_not == nil
|
||||
music_session_user_history.reload
|
||||
music_session_user_history.session_removed_at.should_not == nil
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ require 'spec_helper'
|
|||
# these tests avoid the use of ActiveRecord and FactoryGirl to do blackbox, non test-instrumented tests
|
||||
describe UserManager do
|
||||
|
||||
|
||||
before(:each) do
|
||||
@user_manager = UserManager.new(:conn => @conn)
|
||||
UserMailer.deliveries.clear
|
||||
|
|
@ -13,12 +12,15 @@ describe UserManager do
|
|||
|
||||
describe "signup" do
|
||||
it "signup successfully" do
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
MaxMindIsp.delete_all # prove that city/state/country will remain nil if no maxmind data
|
||||
MaxMindGeo.delete_all
|
||||
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman1@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
@user.first_name.should == "bob"
|
||||
@user.last_name.should == "smith"
|
||||
@user.email.should == "bob@jamkazam.com"
|
||||
@user.email.should == "userman1@jamkazam.com"
|
||||
@user.email_confirmed.should be_false
|
||||
@user.city.should be_nil
|
||||
@user.state.should be_nil
|
||||
|
|
@ -30,7 +32,7 @@ describe UserManager do
|
|||
end
|
||||
|
||||
it "signup successfully with instruments" do
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil,
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman2@jamkazam.com", "foobar", "foobar", true, nil,
|
||||
@instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm")
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
|
|
@ -41,7 +43,7 @@ describe UserManager do
|
|||
end
|
||||
|
||||
it "doesnt fail if ip address is nil" do
|
||||
@user = @user_manager.signup(nil, "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
@user = @user_manager.signup(nil, "bob", "smith", "userman3@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
@user.city.should be_nil
|
||||
|
|
@ -53,7 +55,7 @@ describe UserManager do
|
|||
MaxMindManager.active_record_transaction do |manager|
|
||||
manager.create_phony_database()
|
||||
end
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman4@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
@user.city.should == 'City 127'
|
||||
|
|
@ -65,7 +67,7 @@ describe UserManager do
|
|||
MaxMindManager.active_record_transaction do |manager|
|
||||
manager.create_phony_database()
|
||||
end
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, @location, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman5@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, @location, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
@user.city.should == 'Little Rock'
|
||||
|
|
@ -77,7 +79,7 @@ describe UserManager do
|
|||
MaxMindManager.active_record_transaction do |manager|
|
||||
manager.create_phony_database()
|
||||
end
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, {}, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman6@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, {}, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
@user.city.should be_nil
|
||||
|
|
@ -90,7 +92,7 @@ describe UserManager do
|
|||
MaxMindManager.active_record_transaction do |manager|
|
||||
manager.create_phony_database()
|
||||
end
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, Date.new(2001, 1, 1), nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman7@jamkazam.com", "foobar", "foobar", true, nil, @instruments, Date.new(2001, 1, 1), nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
@user.birth_date.should == Date.new(2001, 1, 1)
|
||||
|
|
@ -98,19 +100,19 @@ describe UserManager do
|
|||
|
||||
|
||||
it "duplicate signup failure" do
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm")
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman8@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 1
|
||||
@user.errors.any?.should be_false
|
||||
|
||||
# exactly the same parameters; should dup on email, and send no email
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm")
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman8@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 1
|
||||
@user.errors.any?.should be_true
|
||||
@user.errors[:email][0].should == "has already been taken"
|
||||
end
|
||||
|
||||
it "fail on no username" do
|
||||
@user = @user_manager.signup("127.0.0.1", "", "", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm")
|
||||
@user = @user_manager.signup("127.0.0.1", "", "", "userman10@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 0
|
||||
@user.errors.any?.should be_true
|
||||
@user.errors[:first_name][0].should == "can't be blank"
|
||||
|
|
@ -127,7 +129,7 @@ describe UserManager do
|
|||
|
||||
describe "signup_confirm" do
|
||||
it "fail on no username" do
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman11@jamkazam.com", "foobar", "foobar", true, nil, @instruments, nil, nil, true, nil, nil, "http://localhost:3000/confirm" )
|
||||
@user = @user_manager.signup_confirm(@user.signup_token)
|
||||
@user.email_confirmed.should be_true
|
||||
end
|
||||
|
|
@ -215,7 +217,7 @@ describe UserManager do
|
|||
UserMailer.deliveries.clear
|
||||
|
||||
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "bob@jamkazam.com", "foobar", "foobar", true, nil,
|
||||
@user = @user_manager.signup("127.0.0.1", "bob", "smith", "userman12@jamkazam.com", "foobar", "foobar", true, nil,
|
||||
@instruments, nil, nil, true, nil, @invitation, "http://localhost:3000/confirm")
|
||||
|
||||
@user.errors.any?.should be_false
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ describe "Artifact API ", :type => :api do
|
|||
|
||||
subject { page }
|
||||
|
||||
before(:each) do
|
||||
ArtifactUpdate.delete_all
|
||||
end
|
||||
|
||||
describe "versioncheck" do
|
||||
before do
|
||||
@artifact = FactoryGirl.create(:artifact_update)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ describe "Music Session API ", :type => :api do
|
|||
|
||||
subject { page }
|
||||
|
||||
before(:each) do
|
||||
MusicSession.delete_all
|
||||
end
|
||||
|
||||
def login(user)
|
||||
post '/sessions', "session[email]" => user.email, "session[password]" => user.password
|
||||
rack_mock_session.cookie_jar["remember_token"].should == user.remember_token
|
||||
|
|
@ -424,7 +428,7 @@ describe "Music Session API ", :type => :api do
|
|||
end
|
||||
|
||||
it "join_requests don't show up in session listing" do
|
||||
client = FactoryGirl.create(:connection, :user => user, :ip_address => "1.1.1.1", :client_id => "1")
|
||||
client = FactoryGirl.create(:connection, :user => user, :ip_address => "1.1.1.1")
|
||||
post '/api/sessions.json', defopts.merge({:client_id => client.client_id}).to_json, "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should eql(201)
|
||||
|
||||
|
|
@ -474,7 +478,7 @@ describe "Music Session API ", :type => :api do
|
|||
end
|
||||
|
||||
it "should now allow join of approval_required=true session" do
|
||||
client = FactoryGirl.create(:connection, :user => user, :ip_address => "1.1.1.1", :client_id => "1")
|
||||
client = FactoryGirl.create(:connection, :user => user, :ip_address => "1.1.1.1")
|
||||
post '/api/sessions.json', defopts.merge({:client_id => client.client_id, :approval_required => true}).to_json, "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should eql(201)
|
||||
|
||||
|
|
|
|||
|
|
@ -939,7 +939,7 @@ describe "User API", :type => :api do
|
|||
|
||||
describe "finalize update email" do
|
||||
it "success" do
|
||||
begin_update_email(user, "not_taken_test@jamkazam.com", user.password)
|
||||
begin_update_email(user, "not_taken_test2@jamkazam.com", user.password)
|
||||
logout
|
||||
user.reload
|
||||
last_response = finalize_update_email(user.update_email_token)
|
||||
|
|
|
|||
|
|
@ -93,12 +93,9 @@ Spork.prefork do
|
|||
config.infer_base_class_for_anonymous_controllers = false
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with(:truncation, {:except => %w[instruments genres] })
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
# DatabaseCleaner.strategy = :transaction
|
||||
DatabaseCleaner.strategy = :truncation, {:except => %w[instruments genres] }
|
||||
|
||||
if example.metadata[:js]
|
||||
page.driver.resize(1920, 1080)
|
||||
|
|
@ -107,18 +104,15 @@ Spork.prefork do
|
|||
end
|
||||
|
||||
config.before(:each, :js => true) do
|
||||
DatabaseCleaner.strategy = :truncation, {:except => %w[instruments genres] }
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
if example.metadata[:js]
|
||||
sleep 0.2 # ugh. necessary though otherwise intermittent failures: http://stackoverflow.com/questions/14265983/upgrading-capybara-from-1-0-1-to-1-1-4-makes-database-cleaner-break-my-specs
|
||||
#sleep (ENV['SLEEP_JS'] || 0.2).to_i # necessary though otherwise intermittent failures: http://stackoverflow.com/questions/14265983/upgrading-capybara-from-1-0-1-to-1-1-4-makes-database-cleaner-break-my-specs
|
||||
end
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ module JamWebsockets
|
|||
end
|
||||
end
|
||||
|
||||
def stop
|
||||
EventMachine::stop_event_loop
|
||||
end
|
||||
|
||||
def start_websocket_listener(listen_ip, port, emwebsocket_debug)
|
||||
EventMachine::WebSocket.start(:host => listen_ip, :port => port, :debug => emwebsocket_debug) do |ws|
|
||||
@log.info "new client #{ws}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue