Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: dd09ac7014
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 27 lines (22 sloc) 0.724 kb
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
$:.unshift File.dirname(__FILE__) + '/../lib'
require 'g'

describe 'g' do
  it 'calls with a arg' do
    GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => "foo")
    g('foo').should == 'foo'
  end

  it 'calls with args' do
    GNTP.should_receive(:notify).exactly(2).times
    g('foo', 1).should == ['foo', 1]
  end

  it 'calls for instance' do
    object = Object.new
    GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => object.pretty_inspect)
    object.g.should == object
  end

  it 'calls with &block' do
    object = "foo"
    GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => "FOO")
    object.g {|i| i.upcase}.should == object
  end
end
Something went wrong with that request. Please try again.