* VRFS-259: beta signup
This commit is contained in:
parent
984fad86e0
commit
9e4468d1af
1
Gemfile
1
Gemfile
|
|
@ -30,6 +30,7 @@ gem 'sendgrid'
|
|||
gem 'rb-readline'
|
||||
gem 'aasm', '3.0.16'
|
||||
gem 'carrierwave'
|
||||
gem 'devise'
|
||||
|
||||
group :development do
|
||||
gem 'pry'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,19 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
# establish database connection before including JamRuby
|
||||
require 'active_record'
|
||||
bin_dir = File.expand_path(File.dirname(__FILE__))
|
||||
|
||||
app_config_file = File.join(bin_dir, '..', 'config', 'application.yml')
|
||||
db_config_file = File.join(bin_dir, '..', 'config', 'database.yml')
|
||||
|
||||
config = YAML::load(File.open(app_config_file))[jamenv]
|
||||
db_config = YAML::load(File.open(db_config_file))[jamenv]
|
||||
|
||||
ActiveRecord::Base.establish_connection(db_config)
|
||||
|
||||
|
||||
# now bring in the Jam code
|
||||
require 'jam_websockets'
|
||||
|
||||
include JamWebsockets
|
||||
|
|
@ -9,13 +23,6 @@ include JamWebsockets
|
|||
jamenv = ENV['JAMENV']
|
||||
jamenv ||= 'development'
|
||||
|
||||
bin_dir = File.expand_path(File.dirname(__FILE__))
|
||||
|
||||
app_config_file = File.join(bin_dir, '..', 'config', 'application.yml')
|
||||
db_config_file = File.join(bin_dir, '..', 'config', 'database.yml')
|
||||
|
||||
config = YAML::load(File.open(app_config_file))[jamenv]
|
||||
db_config = YAML::load(File.open(db_config_file))[jamenv]
|
||||
|
||||
if config["verbose"]
|
||||
Logging.logger.root.level = :debug
|
||||
|
|
@ -30,7 +37,6 @@ else
|
|||
Logging.logger.root.appenders = Logging.appenders.stdout
|
||||
end
|
||||
|
||||
ActiveRecord::Base.establish_connection(db_config)
|
||||
Server.new.run(:port => config["port"],
|
||||
:emwebsocket_debug => config["emwebsocket_debug"],
|
||||
:connect_time_stale => config["connect_time_stale"],
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ module JamWebsockets
|
|||
# attempt login with username and password
|
||||
user = User.find_by_email(username)
|
||||
|
||||
if !user.nil? && user.authenticate(password)
|
||||
if !user.nil? && user.valid_password?(password)
|
||||
@log.debug "#{user} login via password"
|
||||
return user
|
||||
else
|
||||
|
|
|
|||
|
|
@ -10,10 +10,16 @@ FactoryGirl.define do
|
|||
city "Apex"
|
||||
state "NC"
|
||||
country "USA"
|
||||
terms_of_service true
|
||||
|
||||
|
||||
factory :admin do
|
||||
admin true
|
||||
end
|
||||
|
||||
before(:create) do |user|
|
||||
user.musician_instruments << FactoryGirl.build(:musician_instrument, user: user)
|
||||
end
|
||||
end
|
||||
|
||||
factory :music_session, :class => JamRuby::MusicSession do
|
||||
|
|
@ -29,4 +35,14 @@ FactoryGirl.define do
|
|||
ip_address "1.1.1.1"
|
||||
as_musician true
|
||||
end
|
||||
|
||||
factory :instrument, :class => JamRuby::Instrument do
|
||||
description { |n| "Instrument #{n}" }
|
||||
end
|
||||
|
||||
factory :musician_instrument, :class=> JamRuby::MusicianInstrument do
|
||||
instrument { Instrument.find('electric guitar') }
|
||||
proficiency_level 1
|
||||
priority 0
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,15 @@
|
|||
require 'active_record'
|
||||
require 'jam_db'
|
||||
require 'spec_db'
|
||||
|
||||
# recreate test database and migrate it
|
||||
db_config = YAML::load(File.open('config/database.yml'))["test"]
|
||||
|
||||
SpecDb::recreate_database()
|
||||
# initialize ActiveRecord's db connection
|
||||
ActiveRecord::Base.establish_connection(db_config)
|
||||
|
||||
|
||||
require 'jam_websockets'
|
||||
require 'timeout'
|
||||
require 'evented-spec'
|
||||
|
|
@ -23,12 +32,6 @@ end
|
|||
|
||||
Logging.logger.root.appenders = Logging.appenders.stdout
|
||||
|
||||
# recreate test database and migrate it
|
||||
db_config = YAML::load(File.open('config/database.yml'))["test"]
|
||||
|
||||
SpecDb::recreate_database()
|
||||
# initialize ActiveRecord's db connection
|
||||
ActiveRecord::Base.establish_connection(db_config)
|
||||
|
||||
require 'jam_ruby'
|
||||
require 'jampb'
|
||||
|
|
@ -67,20 +70,24 @@ include Jampb
|
|||
config.run_all_when_everything_filtered = true
|
||||
config.filter_run :focus
|
||||
|
||||
config.before(:suite) do
|
||||
# DatabaseCleaner.strategy = :transaction
|
||||
# DatabaseCleaner.clean_with(:truncation)
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
# DatabaseCleaner.start
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
ActiveRecord::Base.connection.execute('select truncate_tables()')
|
||||
# DatabaseCleaner.clean
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.strategy = :truncation, {:except => %w[instruments genres] }
|
||||
DatabaseCleaner.clean_with(:truncation, {:except => %w[instruments genres] })
|
||||
end
|
||||
|
||||
#config.after(:each) do
|
||||
# ActiveRecord::Base.connection.execute('select truncate_tables()')
|
||||
# # DatabaseCleaner.clean
|
||||
# end
|
||||
|
||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, remove the following line or assign false
|
||||
# instead of true.
|
||||
|
|
|
|||
Loading…
Reference in New Issue