spec/integration/hipbot_spec.rb in hipbot-0.0.5 vs spec/integration/hipbot_spec.rb in hipbot-0.1.0
- old
+ new
@@ -28,18 +28,18 @@
end
on /tell me the project name/ do
reply(project_name)
end
on /tell me my name/ do
- reply(sender_first_name)
+ reply("you are #{sender.first_name}")
end
end
describe MyHipbot do
# TODO: replace with actual objects
- let(:room) { Hipbot::Room.new('123', 'private') }
- let(:sender) { 'John Doe' }
+ let(:room) { Hipbot::Room.create('1', 'private', topic: 'topic') }
+ let(:sender) { Hipbot::User.create('1', 'John Doe') }
describe "configuration" do
it "should set robot name" do
subject.name.should == 'robbot'
end
@@ -49,32 +49,32 @@
end
end
describe "replying" do
it "should reply to hello" do
- subject.expects(:reply).with(room, 'hello!')
- subject.tell(sender, room, '@robbot hello hipbot!')
+ subject.expects(:send_to_room).with(room, 'hello!')
+ subject.react(sender, room, '@robbot hello hipbot!')
end
it "should reply with argument" do
- subject.expects(:reply).with(room, "I know I'm cool")
- subject.tell(sender, room, "@robbot you're cool, robot")
+ subject.expects(:send_to_room).with(room, "I know I'm cool")
+ subject.react(sender, room, "@robbot you're cool, robot")
end
it "should reply to global message" do
- subject.expects(:reply).with(room, "hello!")
- subject.tell(sender, room, "hi everyone!")
+ subject.expects(:send_to_room).with(room, "hello!")
+ subject.react(sender, room, "hi everyone!")
end
end
describe "custom helpers" do
it "should have access to room variable" do
- subject.expects(:reply).with(room, 'private project')
- subject.tell(sender, room, '@robbot tell me the project name')
+ subject.expects(:send_to_room).with(room, 'private project')
+ subject.react(sender, room, '@robbot tell me the project name')
end
it "should have access to message variable" do
- subject.expects(:reply).with(room, 'you are John')
- subject.tell(sender, room, '@robbot tell me my name')
+ subject.expects(:send_to_room).with(room, 'you are John')
+ subject.react(sender, room, '@robbot tell me my name')
end
end
end