spec/dsl_spec.rb in chatterbot-0.6.6 vs spec/dsl_spec.rb in chatterbot-0.7.0
- old
+ new
@@ -1,11 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Chatterbot::DSL" do
describe "client routines" do
before(:each) do
- @bot = mock(Chatterbot::Bot)
+ @bot = mock(Chatterbot::Bot, :config => {})
@bot.send :require, 'chatterbot/dsl'
Chatterbot::DSL.stub!(:bot).and_return(@bot)
end
@@ -82,19 +82,33 @@
it "#replies passes along to bot object" do
@bot.should_receive(:replies)
replies
end
+ it "#followers passes along to bot object" do
+ @bot.should_receive(:followers)
+ followers
+ end
+
it "#tweet passes along to bot object" do
@bot.should_receive(:tweet).with("hello sailor!", {:foo => "bar" }, nil)
tweet "hello sailor!", {:foo => "bar"}
end
it "#reply passes along to bot object" do
@bot.should_receive(:reply).with("hello sailor!", { :source => "source "})
reply "hello sailor!", { :source => "source "}
end
+ context "setters" do
+ [:consumer_secret, :consumer_key, :token, :secret].each do |k|
+ it "should be able to set #{k}" do
+ send(k, "foo")
+ @bot.config[k].should == "foo"
+ end
+ end
+ end
+
describe "update_config" do
it "should pass to bot object" do
@bot.should_receive(:update_config)
update_config
end