Sha256: fce497fc9b7beb4090df4b3419b69ee046dde814829028bd28f7ed1b6a66601f
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
require 'spec_helper' require 'muzang-plugins/muzang-meme' describe "Meme" do before do @bot = stub(:channels => ["#test"]) @meme = Meme.new(@bot) @connection = ConnectionMock.new @url = "http://version1.api.memegenerator.net:80/Instance_Create?username=drug-bot&password=drug-bot&languageCode=en&generatorID=2&imageID=166088&text0=hi0&text1=hi1" @file = File.expand_path("../support/responses/meme.response", __FILE__) EventMachine::MockHttpRequest.pass_through_requests = false EventMachine::MockHttpRequest.register_file(@url, :get, @file) EventMachine::MockHttpRequest.activate! @message = OpenStruct.new({:channel => "#test", :message => "meme", :nick => "LTe" }) end it "should print pretty help" do EM.run do @meme.call(@connection, @message) eventually(true) do @connection.messages.include?("Type 'meme [name of meme] \"Text0\" \"Text1\"'") and @connection.messages.include?("Available memes: #{Meme::MEMES.keys.join(" ")}") end end end it "should create meme and send message" do @message.message = "meme y_u_no? \"hi0\" \"hi1\"" EM.run do @meme.call(@connection, @message) eventually(1) { @connection.message_count } eventually(true) { @connection.messages.include? "Meme: http://version1.api.memegenerator.net//cache/instances/400x/10/10725/10982714.jpg" } end end it "should not create meme" do @message.message = "meme asdkasdj \"hi0\" \"hi1\"" EM.run do @meme.call(@connection, @message) eventually(0) { @connection.message_count } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
muzang-plugins-1.1.4 | spec/meme_spec.rb |
muzang-plugins-1.1.3 | spec/meme_spec.rb |
muzang-plugins-1.1.2 | spec/meme_spec.rb |