Sha256: e1658360fa86f4abc42923fbc55dc276e88b30e20a5277ee0670dc8b75e436cf

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

RSpec.describe "script/brain", :session do
  let(:julian) {
    ::Boty::Slack::User.new(
      "id" => "U7777",
      "name" => "julian"
    )
  }

  let(:valeriano) {
    ::Boty::Slack::User.new(
      "id" => "U9876",
      "name" => "valeriano"
    )
  }

  before do
    allow(::Boty::Slack.users).to receive(:info).with("U9876")
      .and_return(valeriano)
    allow(::Boty::Slack.users).to receive(:info).with("U7777")
      .and_return julian

    start_session
  end

  it "stores something about the user issuing the command" do
    expect(bot).to receive(:im)
      .with "No worries, your secrets aren't safe with me... oh wait..."

    faye.message "<@#{bot.name}>: remember I'm at the dentist until 12pm",
                 user: "U9876"

    expect(bot.brain[:user]["valeriano"].first)
      .to eq "I'm at the dentist until 12pm"
  end

  it "recovers information from the brain" do
    allow(bot).to receive(:im)
    faye.message "<@#{bot.name}>: remember I'm at the dentist until 12pm",
                 user: "U9876"

    expect(bot).to receive(:im)
      .with("julian, I'm searching my user database for valeriano:\n")
    expect(bot).to receive(:im)
      .with("```\n - I'm at the dentist until 12pm\n```")

    faye.message "<@#{bot.name}>: about user valeriano",
                 user: "U7777"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boty-1.0.1 spec/script/remember_spec.rb
boty-1.0.0 spec/script/remember_spec.rb
boty-0.2.0 spec/script/remember_spec.rb
boty-0.1.2 spec/script/remember_spec.rb
boty-0.1.1 spec/script/remember_spec.rb