Skip to content
Browse files

Travis: fixed tests under MySQL and Redis.

  • Loading branch information...
1 parent 0c775b0 commit c079fa2b899f2d9e511881d929ff3709aebd8d02 @assaf assaf committed Aug 1, 2011
Showing with 3 additions and 12 deletions.
  1. +2 −10 lib/vanity/adapters/active_record_adapter.rb
  2. +0 −1 test/experiment/ab_test.rb
  3. +1 −1 test/passenger_test.rb
View
12 lib/vanity/adapters/active_record_adapter.rb
@@ -67,25 +67,17 @@ class VanityParticipant < VanityRecord
# passed to create if creating, or will be used to
# update the found participant.
def self.retrieve(experiment, identity, create = true, update_with = nil)
- record = VanityParticipant.first(
- :conditions =>
- {:experiment_id => experiment.to_s, :identity => identity.to_s})
-
- if record
+ if record = VanityParticipant.first(:conditions=>{ :experiment_id=>experiment.to_s, :identity=>identity.to_s })
record.update_attributes(update_with) if update_with
elsif create
- record = VanityParticipant.create(
- {:experiment_id => experiment.to_s,
- :identity => identity}.merge(update_with || {}))
+ record = VanityParticipant.create({ :experiment_id=>experiment.to_s, :identity=>identity }.merge(update_with || {}))
end
-
record
end
end
def initialize(options)
options[:adapter] = options[:active_record_adapter] if options[:active_record_adapter]
-
VanityRecord.establish_connection(options)
end
View
1 test/experiment/ab_test.rb
@@ -735,7 +735,6 @@ def test_chooses_records_participants_for_new_alternatives
end
experiment(:simple).chooses(:b)
experiment(:simple).chooses(:c)
- assert_equal experiment(:simple).alternatives[1].participants, 1
assert_equal experiment(:simple).alternatives[2].participants, 1
end
View
2 test/passenger_test.rb
@@ -20,7 +20,7 @@ def setup
def test_reconnect
# When using AR adapter, we're not responsible to reconnect, and we're going
# to get the same "connect" (AR connection handler) either way.
- return if Vanity::Adapters::ActiveRecordAdapter === Vanity.playground.connection
+ return if defined?(Vanity::Adapters::ActiveRecordAdapter) && Vanity::Adapters::ActiveRecordAdapter === Vanity.playground.connection
sleep 0.1
case @app.listen_socket_type

0 comments on commit c079fa2

Please sign in to comment.
Something went wrong with that request. Please try again.