spec/tweetstream_spec.rb in tweetstream-1.1.5 vs spec/tweetstream_spec.rb in tweetstream-2.0.0
- old
+ new
@@ -5,27 +5,28 @@
TweetStream.reset
end
context "when delegating to a client" do
before do
- @stream = stub("Twitter::JSONStream",
+ @stream = stub("EM::Twitter::Client",
:connect => true,
:unbind => true,
:each_item => true,
:on_error => true,
:on_max_reconnects => true,
:on_reconnect => true,
- :connection_completed => true
+ :connection_completed => true,
+ :on_no_data_received => true
)
EM.stub!(:run).and_yield
- Twitter::JSONStream.stub!(:connect).and_return(@stream)
+ EM::Twitter::Client.stub!(:connect).and_return(@stream)
end
it "should return the same results as a client" do
MultiJson.should_receive(:decode).and_return({})
- @stream.should_receive(:each_item).and_yield(sample_tweets[0].to_json)
- TweetStream.track('abc','def').should == TweetStream::Client.new.track('abc','def')
+ @stream.should_receive(:each).and_yield(sample_tweets[0].to_json)
+ TweetStream.track('abc','def')
end
end
describe ".new" do
it "should be a TweetStream::Client" do
@@ -37,23 +38,10 @@
it "should take an optional argument" do
TweetStream.respond_to?(:new, true).should be_true
end
end
- describe ".parser" do
- it "should return the default parser" do
- TweetStream.parser.should == TweetStream::Configuration::DEFAULT_PARSER
- end
- end
-
- describe ".parser=" do
- it "should set the adapter" do
- TweetStream.parser = :yajl
- TweetStream.parser.should == :yajl
- end
- end
-
describe ".username" do
it "should return the default username" do
TweetStream.username.should == TweetStream::Configuration::DEFAULT_USERNAME
end
end
@@ -110,9 +98,21 @@
TweetStream.configure do |config|
config.send("#{key}=", key)
TweetStream.send(key).should == key
end
end
+ end
+ end
+
+ describe '.options' do
+ it 'returns the configuration as a hash' do
+ TweetStream.options.should be_kind_of(Hash)
+ end
+ end
+
+ describe '.oauth_options' do
+ it 'returns the oauth configuration as a hash' do
+ TweetStream.oauth_options.should be_kind_of(Hash)
end
end
end