Sha256: 0c264e02a515c25b5a6fafcda37c7428f52556a8b8ded044b00de8d535cda35a
Contents?: true
Size: 1.73 KB
Versions: 4
Compression:
Stored size: 1.73 KB
Contents
require "faraday" RSpec.describe "script/pug", :session do before do start_session end describe "pug me", :faraday do before do requests.get("/random") do [200, { "Content-Type" => "application/json;charset=utf-8" }, { pug: "some_pug" }.to_json] end end it "displays a pug" do expect(bot).to receive(:say).with "<some_pug>" faye.message "<@jeeba>:pug me" end end describe "pug bomb x", :faraday do it "displays x pugs" do requests.get("/bomb") do |env| expect(env.params).to eq "count" => "3" [200, { "Content-Type" => "application/json;charset=utf-8" }, { pugs: %w(1 2 3) }.to_json] end (1..3).each do |num| expect(bot).to receive(:say).with("<#{num}>") end faye.message "<@jeeba>: pug bomb 3" end it "defaults to 5 pugs when no count is given" do requests.get("/bomb") do |env| expect(env.params).to eq "count" => "5" [200, { "Content-Type" => "application/json;charset=utf-8" }, { pugs: %w(1 2 3 4 5) }.to_json] end (1..5).each do |num| expect(bot).to receive(:say).with("<#{num}>") end faye.message "<@jeeba>: pug bomb" end it "forbbidens more than 5 pugs" do requests.get("/bomb") do |env| expect(env.params).to eq "count" => "5" [200, { "Content-Type" => "application/json;charset=utf-8" }, { pugs: %w(1 2 3 4 5) }.to_json] end expect(bot).to receive(:say).with("wow! so many pugs! sending 5 instead.") (1..5).each do |num| expect(bot).to receive(:say).with("<#{num}>") end faye.message "<@jeeba>: pug bomb 20" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
boty-1.0.1 | spec/script/pug_spec.rb |
boty-1.0.0 | spec/script/pug_spec.rb |
boty-0.2.0 | spec/script/pug_spec.rb |
boty-0.1.2 | spec/script/pug_spec.rb |