Sha256: a16d6031a28dbcc0858eaa718d890ec8b860b81b7c79cda3facbac2d56b99185

Contents?: true

Size: 1.76 KB

Versions: 14

Compression:

Stored size: 1.76 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Chatterbot::Profile" do
  describe "#profile_text" do
    let(:user) { fake_user('user', 100) }
    let(:bot) { test_bot }


    it "calls require_login" do
      expect(bot).to receive(:require_login).and_return(false)
      bot.profile_text "set my profile!"
    end

    context "data" do
      before(:each) do
        expect(bot).to receive(:require_login).and_return(true)
        allow(bot).to receive(:client).and_return(double(Twitter::Client))

        allow(bot).to receive(:debug_mode?).and_return(false)
      end

      it "calls client.user to get" do   
        expect(bot.client).to receive(:user).and_return(user)
        bot.profile_text
      end

      it "calls client.update_profile to set" do   
        expect(bot.client).to receive(:update_profile).with(description:"hello")
        bot.profile_text "hello"
      end
    end
  end


  describe "#profile_website" do
    let(:user) { fake_user('user', 100) }
    let(:bot) { test_bot }


    it "calls require_login" do
      expect(bot).to receive(:require_login).and_return(false)
      bot.profile_website "set my profile!"
    end

    context "data" do
      before(:each) do
        expect(bot).to receive(:require_login).and_return(true)
        allow(bot).to receive(:client).and_return(double(Twitter::Client))

        allow(bot).to receive(:debug_mode?).and_return(false)
      end

      it "calls client.user to get" do   
        expect(bot.client).to receive(:user).and_return(user)
        bot.profile_website
      end

      it "calls client.update_profile to set" do   
        expect(bot.client).to receive(:update_profile).with(url:"http://hello.com")
        bot.profile_website "http://hello.com"
      end
    end
  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
chatterbot-2.2.0 spec/profile_spec.rb
chatterbot-2.1.0 spec/profile_spec.rb
chatterbot-2.0.5 spec/profile_spec.rb
chatterbot-2.0.4 spec/profile_spec.rb
chatterbot-2.0.3 spec/profile_spec.rb
chatterbot-2.0.2 spec/profile_spec.rb
chatterbot-1.0.2 spec/profile_spec.rb
chatterbot-2.0.0.pre spec/profile_spec.rb
chatterbot-1.0.1 spec/profile_spec.rb
chatterbot-1.0.0 spec/profile_spec.rb
chatterbot-0.9.3 spec/profile_spec.rb
chatterbot-0.9.2 spec/profile_spec.rb
chatterbot-0.9.1 spec/profile_spec.rb
chatterbot-0.9.0 spec/profile_spec.rb