Permalink
Browse files

Added rake & rspec to development dependencies, updated specs for rsp…

…ec 2
  • Loading branch information...
1 parent 7b3af87 commit e19cf301d32dff3cc09567f151d989f94649938f @mloughran mloughran committed Nov 22, 2010
Showing with 16 additions and 10 deletions.
  1. +4 −4 Rakefile
  2. +3 −1 em-websocket.gemspec
  3. +9 −5 spec/helper.rb
View
@@ -1,9 +1,9 @@
require 'bundler'
Bundler::GemHelper.install_tasks
-require 'spec/rake/spectask'
+require 'rspec/core/rake_task'
-Spec::Rake::SpecTask.new do |t|
- t.ruby_opts = ['-rtest/unit']
- t.spec_files = FileList['spec/**/*_spec.rb']
+RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = ["-c", "-f progress", "-r ./spec/helper.rb"]
+ t.pattern = 'spec/**/*_spec.rb'
end
@@ -21,5 +21,7 @@ Gem::Specification.new do |s|
s.add_dependency("eventmachine", ">= 0.12.9")
s.add_dependency("addressable", '>= 2.1.1')
- s.add_development_dependency('em-http-request', '>= 0.2.6')
+ s.add_development_dependency('em-http-request', '~> 0.2.6')
+ s.add_development_dependency('rspec', "~> 2.0.0")
+ s.add_development_dependency('rake')
end
View
@@ -1,9 +1,13 @@
require 'rubygems'
-require 'spec'
+require 'rspec'
require 'pp'
require 'em-http'
-require 'lib/em-websocket'
+require 'em-websocket'
+
+Rspec.configure do |c|
+ c.mock_with :rspec
+end
class FakeWebSocketClient < EM::Connection
attr_writer :onopen, :onclose, :onmessage
@@ -59,8 +63,8 @@ def handler(request, secure = false)
EM::WebSocket::HandlerFactory.build(connection, format_request(request), secure)
end
-def send_handshake(response)
- simple_matcher do |given|
- given.handshake.lines.sort == format_response(response).lines.sort
+RSpec::Matchers.define :send_handshake do |response|
+ match do |actual|
+ actual.handshake.lines.sort == format_response(response).lines.sort
end
end

0 comments on commit e19cf30

Please sign in to comment.