forked from rweald/gnip-stream
/
xml_stream_spec.rb
30 lines (26 loc) · 970 Bytes
/
xml_stream_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'spec_helper'
require 'gnip-stream/xml_stream'
describe GnipStream::XmlStream do
subject { GnipStream::XmlStream.new("http://example.com") }
describe "#initialize" do
it "creates underlying stream object with a json specific data buffer" do
GnipStream::Stream.should_receive(:new) do |url, processor, headers|
url.should == "http://example.com"
end
GnipStream::XmlStream.new("http://example.com")
end
end
describe "#method_missing" do
let(:underlying_stream) { double("GnipStream::Stream") }
before do
GnipStream::Stream.stub(:new => underlying_stream)
end
it "delegates all available methods to the underlying stream class" do
underlying_stream.should_receive(:connect)
subject.connect
end
it "raises a method not found error on self if underlying stream can not respond to the method" do
lambda { subject.foobar }.should raise_error(NoMethodError)
end
end
end