Skip to content

Commit

Permalink
Add requires and setup for new gems. Spin up Faye in a seperate threa…
Browse files Browse the repository at this point in the history
…d and port.
  • Loading branch information
oponder committed Mar 12, 2013
1 parent 911570a commit bd44210
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -11,6 +11,30 @@
require 'rspec/autorun'
require "#{Rails.root}/lib/active_users.rb"

require 'capybara/rails'
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist

require 'faye'
require ::File.expand_path("../../lib/active_users.rb", __FILE__)
require ::File.expand_path("../../lib/faye_extensions/devise_auth.rb", __FILE__)

faye_server = Faye::RackAdapter.new(:mount => "/remote/faye", :timeout => 30)
faye_server.add_extension(DeviseAuth.new)

FAYE_CLIENT = faye_server.get_client

faye_server.bind(:unsubscribe) do |client_id|
ActiveUsers.remove_by_client_id(client_id)
end

Thread.new {faye_server.listen(9292)}

Capybara.app = Rack::URLMap.new({
"/" => Kandan::Application
})

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Expand All @@ -29,7 +53,7 @@
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false

# Database cleaner
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
Expand Down

0 comments on commit bd44210

Please sign in to comment.