File: user_spec.rb

package info (click to toggle)
atig 0.6.1-8
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 868 kB
  • sloc: ruby: 5,315; makefile: 11; sh: 3
file content (48 lines) | stat: -rw-r--r-- 1,564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- mode:ruby; coding:utf-8 -*-

require 'atig/command/user'

describe Atig::Command::User do
  include CommandHelper
  before do
    @command = init Atig::Command::User
  end

  it "should have '/me status' name" do
    expect(@gateway.names).to eq(['user', 'u'])
  end

  it "should" do
    foo = entry user(1,'mzp'),status('foo')
    bar = entry user(1,'mzp'),status('bar')
    baz = entry user(1,'mzp'),status('baz')
    expect(@api).
      to receive(:get).
      with('statuses/user_timeline',{:count=>20,:screen_name=>'mzp'}).
      and_return([foo, bar, baz])
    expect(@statuses).to receive(:add).with(any_args).at_least(3)
    expect(@statuses).
      to receive(:find_by_screen_name).
      with('mzp',:limit=>20).
      and_return([foo, bar, baz])
    expect(@channel).to receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
    call "#twitter","user",%w(mzp)
  end

  it "should get specified statuses" do
    foo = entry user(1,'mzp'),status('foo')
    bar = entry user(1,'mzp'),status('bar')
    baz = entry user(1,'mzp'),status('baz')
    expect(@api).
      to receive(:get).
      with('statuses/user_timeline',{:count=>200,:screen_name=>'mzp'}).
      and_return([foo, bar, baz])
    expect(@statuses).to receive(:add).with(any_args).at_least(3)
    expect(@statuses).
      to receive(:find_by_screen_name).
      with('mzp',:limit=>200).
      and_return([foo, bar, baz])
    expect(@channel).to receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
    call "#twitter","user",%w(mzp 200)
  end
end