Sha256: 14201640197255ddee5acc46ebbe4e2a42b4f67f4d19629a4ab3bbd77e74d749

Contents?: true

Size: 899 Bytes

Versions: 18

Compression:

Stored size: 899 Bytes

Contents

require "spec_helper"

describe Lita::Handlers::Users, lita_handler: true do
  it { is_expected.to route_command("users find carl").to(:find) }

  describe "#find" do
    it "finds users by ID" do
      send_command("users find 1")

      expect(replies.first).to eq("Test User (ID: 1, Mention name: Test User)")
    end

    it "finds users by name" do
      send_command("users find 'Test User'")

      expect(replies.first).to eq("Test User (ID: 1, Mention name: Test User)")
    end

    it "finds users by mention name" do
      Lita::User.create(2, name: "Mr. Pug", mention_name: "carl")

      send_command("users find carl")

      expect(replies.first).to eq("Mr. Pug (ID: 2, Mention name: carl)")
    end

    it "replies with a message when no matches are found" do
      send_command("users find nobody")

      expect(replies.first).to eq("No matching users found.")
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
lita-4.8.0 spec/lita/handlers/users_spec.rb
lita-4.8.0.beta1 spec/lita/handlers/users_spec.rb
lita-4.7.1 spec/lita/handlers/users_spec.rb
lita-default-handlers-0.1.0 spec/lita/handlers/users_spec.rb
lita-4.7.0 spec/lita/handlers/users_spec.rb
lita-4.6.1 spec/lita/handlers/users_spec.rb
lita-4.6.0 spec/lita/handlers/users_spec.rb
lita-4.5.0 spec/lita/handlers/users_spec.rb
lita-4.4.3 spec/lita/handlers/users_spec.rb
lita-4.4.2 spec/lita/handlers/users_spec.rb
lita-4.4.1 spec/lita/handlers/users_spec.rb
lita-4.4.0 spec/lita/handlers/users_spec.rb
lita-4.3.2 spec/lita/handlers/users_spec.rb
lita-4.3.1 spec/lita/handlers/users_spec.rb
lita-4.3.0 spec/lita/handlers/users_spec.rb
lita-4.2.1 spec/lita/handlers/users_spec.rb
lita-4.2.0 spec/lita/handlers/users_spec.rb
lita-4.1.0 spec/lita/handlers/users_spec.rb