spec/app_spec.rb in hara-0.2.0 vs spec/app_spec.rb in hara-0.2.1
- old
+ new
@@ -1,10 +1,12 @@
require 'spec_helper'
describe Hara::App do
before :all do
- Class.new Hara::App do
+ Class.new do
+ include Hara::App
+
def after_connect
@states = []
end
def before_action action, *args
@@ -41,9 +43,15 @@
after :each do
if @app && @app.alive?
@app.terminate!
end
+ end
+
+ it 'client_infos' do
+ @app.client_ip.should == '127.0.0.1'
+ @app.client_port.should.is_a? Integer
+ @app.headers.should.is_a? Hash
end
it 'remote call actions' do
@app.process_msg(Hara.encode_msg(:hello, ' world'))
sleep 0.1 until msg = @socket.client_read