Changeset 6624

Show
Ignore:
Timestamp:
02/13/08 15:05:53 (5 years ago)
Author:
cho45
Message:

lang/ruby/chokan/branches/citrus/plugins/nico_search.rb,
lang/ruby/chokan/branches/citrus/plugins/twitter_id.rb,
lang/ruby/chokan/branches/citrus/plugins/aa.rb,
lang/ruby/chokan/branches/citrus/plugins/gamer_tag.rb,
lang/ruby/chokan/branches/citrus/plugins/lastfm.rb,
lang/ruby/chokan/branches/citrus/plugins/twitter_search.rb,
lang/ruby/chokan/branches/citrus/plugins/whois.rb,
lang/ruby/chokan/branches/citrus/plugins/decode_unicode.rb,
lang/ruby/chokan/branches/citrus/plugins/erogame_space.rb,
lang/ruby/chokan/branches/citrus/plugins/sakage.rb,
lang/ruby/chokan/branches/citrus/plugins/google_calc.rb,
lang/ruby/chokan/branches/citrus/plugins/google_search.rb,
lang/ruby/chokan/branches/citrus/plugins/dictionary.rb,
lang/ruby/chokan/branches/citrus/plugins/wikipedia.rb,
lang/ruby/chokan/branches/citrus/plugins/auto_uri_escape.rb,
lang/ruby/chokan/branches/citrus/plugins/cer.rb,
lang/ruby/chokan/branches/citrus/plugins/gates_point.rb,
lang/ruby/chokan/branches/citrus/plugins/dcc_cache.rb:

trunk から一斉 add / テストを書く必要がある

Location:
lang/ruby/chokan/branches/citrus/plugins
Files:
18 copied

Legend:

Unmodified
Added
Removed
  • lang/ruby/chokan/branches/citrus/plugins/aa.rb

    r5861 r6624  
    11 
    2 require 'chokan/plugin_base' 
    32require 'uri' 
    43require 'net/http' 
    54require 'hpricot' 
    65 
    7 class Aa < Chokan::PluginBase 
    8         def initialize(config, chokan) 
     6class Aa < Citrus::Plugin 
     7        def initialize(*args) 
    98                super 
    109                @prefix = @config['prefix'] || '(?i:aa) *' 
     
    8180end 
    8281 
     82 
     83tests do 
     84        describe Aa do 
     85                before :all do 
     86                        @core   = DummyCore.new({}) 
     87                        @socket = @core.socket 
     88                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     89 
     90                        @plugin = Aa.new(@core, { "Aa" => { 
     91                        } }) 
     92                end 
     93 
     94                it "should reply correctly" do 
     95#                                       @socket.clear 
     96#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     97#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     98                end 
     99        end 
     100 
     101end 
     102 
  • lang/ruby/chokan/branches/citrus/plugins/auto_uri_escape.rb

    r6410 r6624  
    1 require 'chokan/plugin_base' 
    21require 'uri' 
    32require 'net/http' 
     
    54Net::HTTP.version_1_2 
    65 
    7 class AutoUriEscape < Chokan::PluginBase 
     6class AutoUriEscape < Citrus::Plugin 
    87        REVISION = '$Rev$'.gsub(/\D+/, '').to_i 
    9         def initialize(config, chokan) 
     8        def initialize(*args) 
    109                super 
    1110                @shunirr    = @config['shunirr']    || ' x shunirr' 
     
    6059        end 
    6160end 
     61 
     62tests do 
     63        describe AutoUriEscape do 
     64                before :all do 
     65                        @core   = DummyCore.new({}) 
     66                        @socket = @core.socket 
     67                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     68 
     69                        @plugin = AutoUriEscape.new(@core, { "AutoUriEscape" => { 
     70                        } }) 
     71                end 
     72 
     73                it "should reply correctly" do 
     74#                                       @socket.clear 
     75#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     76#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     77                end 
     78        end 
     79 
     80end 
     81 
  • lang/ruby/chokan/branches/citrus/plugins/cer.rb

    r283 r6624  
    55# currency exchange rate 
    66 
    7 class Cer < Chokan::PluginBase 
     7class Cer < Citrus::Plugin 
    88        CER = {"USD" => "アメリカドル", 
    99               "GBP" => "イギリス ポンド", 
     
    8989        end 
    9090end 
     91 
     92tests do 
     93        describe Cer do 
     94                before :all do 
     95                        @core   = DummyCore.new({}) 
     96                        @socket = @core.socket 
     97                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     98 
     99                        @plugin = Cer.new(@core, { "Cer" => { 
     100                        } }) 
     101                end 
     102 
     103                it "should reply correctly" do 
     104#                                       @socket.clear 
     105#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     106#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     107                end 
     108        end 
     109 
     110end 
     111 
  • lang/ruby/chokan/branches/citrus/plugins/dcc_cache.rb

    r283 r6624  
    11 
    22 
    3 require "chokan/plugin_base" 
    43require "digest/sha1" 
    54 
    6 class DccCache < Chokan::PluginBase 
     5class DccCache < Citrus::Plugin 
    76         
    87        def on_ctcp(prefix, message) 
     
    6564end 
    6665 
     66 
     67tests do 
     68        describe DccCache do 
     69                before :all do 
     70                        @core   = DummyCore.new({}) 
     71                        @socket = @core.socket 
     72                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     73 
     74                        @plugin = DccCache.new(@core, { "DccCache" => { 
     75                        } }) 
     76                end 
     77 
     78                it "should reply correctly" do 
     79#                                       @socket.clear 
     80#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     81#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     82                end 
     83        end 
     84 
     85end 
     86 
  • lang/ruby/chokan/branches/citrus/plugins/decode_unicode.rb

    r283 r6624  
    22require "rubygems" 
    33require "charnames" 
    4 require "chokan/plugin_base" 
    54require "open-uri" 
    65 
    7 class DecodeUnicode < Chokan::PluginBase 
     6class DecodeUnicode < Citrus::Plugin 
    87 
    9         def initialize(config, chokan) 
     8        def initialize(*args) 
    109                super 
    1110        end 
     
    2120        end 
    2221end 
     22 
     23tests do 
     24        describe DecodeUnicode do 
     25                before :all do 
     26                        @core   = DummyCore.new({}) 
     27                        @socket = @core.socket 
     28                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     29 
     30                        @plugin = DecodeUnicode.new(@core, { "DecodeUnicode" => { 
     31                        } }) 
     32                end 
     33 
     34                it "should reply correctly" do 
     35#                                       @socket.clear 
     36#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     37#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     38                end 
     39        end 
     40 
     41end 
     42 
  • lang/ruby/chokan/branches/citrus/plugins/dictionary.rb

    r1511 r6624  
    11 
    22 
    3 require "chokan/plugin_base" 
    43require "rubygems" 
    54require "hpricot" 
    65 
    7 class Dictionary < Chokan::PluginBase 
     6class Dictionary < Citrus::Plugin 
    87        def description 
    98                "none" 
    109        end 
    1110 
    12         def initialize(config, chokan) 
     11        def initialize(*args) 
    1312                super 
    1413        end 
     
    8483end 
    8584 
     85 
     86tests do 
     87        describe Dictionary do 
     88                before :all do 
     89                        @core   = DummyCore.new({}) 
     90                        @socket = @core.socket 
     91                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     92 
     93                        @plugin = Dictionary.new(@core, { "Dictionary" => { 
     94                        } }) 
     95                end 
     96 
     97                it "should reply correctly" do 
     98#                                       @socket.clear 
     99#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     100#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     101                end 
     102        end 
     103 
     104end 
     105 
  • lang/ruby/chokan/branches/citrus/plugins/erogame_space.rb

    r5695 r6624  
    33require 'uri' 
    44 
    5 class ErogameSpace < Chokan::PluginBase 
    6         def initialize(config, chokan) 
     5class ErogameSpace < Citrus::Plugin 
     6        def initialize(*args) 
    77                super 
    88                @prefix = @config['prefix'] || 'erg ' 
     
    4444        end 
    4545end 
     46 
     47tests do 
     48        describe ErogameSpace do 
     49                before :all do 
     50                        @core   = DummyCore.new({}) 
     51                        @socket = @core.socket 
     52                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     53 
     54                        @plugin = ErogameSpace.new(@core, { "ErogameSpace" => { 
     55                        } }) 
     56                end 
     57 
     58                it "should reply correctly" do 
     59#                                       @socket.clear 
     60#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     61#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     62                end 
     63        end 
     64 
     65end 
     66 
  • lang/ruby/chokan/branches/citrus/plugins/gamer_tag.rb

    r451 r6624  
    11 
    2 require 'chokan/plugin_base' 
    32require 'hpricot' 
    43require 'net/http' 
    54 
    6 class GamerTag < Chokan::PluginBase 
    7         def initialize(config, chokan) 
     5class GamerTag < Citrus::Plugin 
     6        def initialize(*args) 
    87                super 
    98                @prefix = @config['prefix'] || 'xbox ' 
     
    3332        end 
    3433end 
     34 
     35tests do 
     36        describe GamerTag do 
     37                before :all do 
     38                        @core   = DummyCore.new({}) 
     39                        @socket = @core.socket 
     40                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     41 
     42                        @plugin = GamerTag.new(@core, { "GamerTag" => { 
     43                        } }) 
     44                end 
     45 
     46                it "should reply correctly" do 
     47#                                       @socket.clear 
     48#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     49#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     50                end 
     51        end 
     52 
     53end 
     54 
  • lang/ruby/chokan/branches/citrus/plugins/gates_point.rb

    r5867 r6624  
    1 require 'chokan/plugin_base' 
    21 
    3 class GatesPoint < Chokan::PluginBase 
    4         def initialize(config, chokan) 
     2class GatesPoint < Citrus::Plugin 
     3        def initialize(*args) 
    54                super 
    65                @suffix = @config['suffix'] || 'gp' 
     
    2726        end 
    2827end 
     28 
     29tests do 
     30        describe GatesPoint do 
     31                before :all do 
     32                        @core   = DummyCore.new({}) 
     33                        @socket = @core.socket 
     34                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     35 
     36                        @plugin = GatesPoint.new(@core, { "GatesPoint" => { 
     37                        } }) 
     38                end 
     39 
     40                it "should reply correctly" do 
     41#                                       @socket.clear 
     42#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     43#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     44                end 
     45        end 
     46 
     47end 
     48 
  • lang/ruby/chokan/branches/citrus/plugins/google_calc.rb

    r6083 r6624  
    1 require 'chokan/plugin_base' 
    21require 'net/http' 
    32require 'uri' 
    43 
    5 class GoogleCalc < Chokan::PluginBase 
     4class GoogleCalc < Citrus::Plugin 
    65        HYDE = 156.0000000 
    76 
    8         def initialize(config, chokan) 
     7        def initialize(*args) 
    98                HYDE.is_a?(Numeric) && HYDE === 156.0 
    109                super 
     
    4443        end 
    4544end 
     45 
     46tests do 
     47        describe GoogleCalc do 
     48                before :all do 
     49                        @core   = DummyCore.new({}) 
     50                        @socket = @core.socket 
     51                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     52 
     53                        @plugin = GoogleCalc.new(@core, { "GoogleCalc" => { 
     54                        } }) 
     55                end 
     56 
     57                it "should reply correctly" do 
     58#                                       @socket.clear 
     59#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     60#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     61                end 
     62        end 
     63 
     64end 
     65 
  • lang/ruby/chokan/branches/citrus/plugins/google_search.rb

    r6083 r6624  
    11 
    2 require 'chokan/plugin_base' 
    32require 'net/http' 
    43require 'rubygems' 
     
    65require 'uri' 
    76 
    8 class GoogleSearch < Chokan::PluginBase 
     7class GoogleSearch < Citrus::Plugin 
    98        def description 
    109                <<-DESCRIPTION.gsub(/^\s+/, '') 
     
    1514        end 
    1615 
    17         def initialize(config, chokan) 
     16        def initialize(*args) 
    1817                super 
    1918                @prefix = @config['prefix'] || 'g' 
     
    6160        end 
    6261end 
     62 
     63tests do 
     64        describe GoogleSearch do 
     65                before :all do 
     66                        @core   = DummyCore.new({}) 
     67                        @socket = @core.socket 
     68                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     69 
     70                        @plugin = GoogleSearch.new(@core, { "GoogleSearch" => { 
     71                        } }) 
     72                end 
     73 
     74                it "should reply correctly" do 
     75#                                       @socket.clear 
     76#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     77#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     78                end 
     79        end 
     80 
     81end 
     82 
  • lang/ruby/chokan/branches/citrus/plugins/lastfm.rb

    r2975 r6624  
    11 
    2 require 'chokan/plugin_base' 
    32require 'net/http' 
    43 
    5 class Lastfm < Chokan::PluginBase 
    6         def initialize(config, chokan) 
     4class Lastfm < Citrus::Plugin 
     5        def initialize(*args) 
    76                super 
    87                @prefix = @config['prefix'] || 'm ' 
     
    3938        end 
    4039end 
     40 
     41tests do 
     42        describe Lastfm do 
     43                before :all do 
     44                        @core   = DummyCore.new({}) 
     45                        @socket = @core.socket 
     46                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     47 
     48                        @plugin = Lastfm.new(@core, { "Lastfm" => { 
     49                        } }) 
     50                end 
     51 
     52                it "should reply correctly" do 
     53#                                       @socket.clear 
     54#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     55#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     56                end 
     57        end 
     58 
     59end 
     60 
  • lang/ruby/chokan/branches/citrus/plugins/nico_search.rb

    r6422 r6624  
    11 
    2 require 'chokan/plugin_base' 
    32require 'rubygems' 
    43require 'mechanize' 
    54require 'hpricot' 
    65 
    7 class NicoSearch < Chokan::PluginBase 
    8         def initialize(config, chokan) 
     6class NicoSearch < Citrus::Plugin 
     7        def initialize(*args) 
    98                super 
    109                @prefix = @config['prefix'] || 'ns' 
     
    4241end 
    4342 
     43 
     44tests do 
     45        describe NicoSearch do 
     46                before :all do 
     47                        @core   = DummyCore.new({}) 
     48                        @socket = @core.socket 
     49                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     50 
     51                        @plugin = NicoSearch.new(@core, { "NicoSearch" => { 
     52                        } }) 
     53                end 
     54 
     55                it "should reply correctly" do 
     56#                                       @socket.clear 
     57#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     58#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     59                end 
     60        end 
     61 
     62end 
     63 
  • lang/ruby/chokan/branches/citrus/plugins/sakage.rb

    r283 r6624  
    11 
    22 
    3 class Sakage < Chokan::PluginBase 
     3class Sakage < Citrus::Plugin 
    44 
    55        Morse2Alpha = { 
     
    159159 
    160160 
     161 
     162tests do 
     163        describe Sakage do 
     164                before :all do 
     165                        @core   = DummyCore.new({}) 
     166                        @socket = @core.socket 
     167                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     168 
     169                        @plugin = Sakage.new(@core, { "Sakage" => { 
     170                        } }) 
     171                end 
     172 
     173                it "should reply correctly" do 
     174#                                       @socket.clear 
     175#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     176#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     177                end 
     178        end 
     179 
     180end 
     181 
  • lang/ruby/chokan/branches/citrus/plugins/twitter_id.rb

    r5415 r6624  
    1 require 'chokan/plugin_base' 
    21require 'net/http' 
    32require 'hpricot' 
    43require 'htmlentities' 
    54 
    6 class TwitterId < Chokan::PluginBase 
    7         def initialize(config, chokan) 
     5class TwitterId < Citrus::Plugin 
     6        def initialize(*args) 
    87                super 
    98                @prefix = @config['prefix'] || 't ' 
     
    7170        end 
    7271end 
     72 
     73tests do 
     74        describe TwitterId do 
     75                before :all do 
     76                        @core   = DummyCore.new({}) 
     77                        @socket = @core.socket 
     78                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     79 
     80                        @plugin = TwitterId.new(@core, { "TwitterId" => { 
     81                        } }) 
     82                end 
     83 
     84                it "should reply correctly" do 
     85#                                       @socket.clear 
     86#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     87#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     88                end 
     89        end 
     90 
     91end 
     92 
  • lang/ruby/chokan/branches/citrus/plugins/twitter_search.rb

    r5989 r6624  
    11 
    2 require 'chokan/plugin_base' 
    32require 'net/http' 
    43require 'rubygems' 
     
    65require 'rexml/document' 
    76 
    8 class TwitterSearch < Chokan::PluginBase 
    9         def initialize(config, chokan) 
     7class TwitterSearch < Citrus::Plugin 
     8        def initialize(*args) 
    109                super 
    1110                @prefix = @config['prefix'] || 'ts' 
     
    4241 
    4342end 
     43 
     44tests do 
     45        describe TwitterSearch do 
     46                before :all do 
     47                        @core   = DummyCore.new({}) 
     48                        @socket = @core.socket 
     49                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     50 
     51                        @plugin = TwitterSearch.new(@core, { "TwitterSearch" => { 
     52                        } }) 
     53                end 
     54 
     55                it "should reply correctly" do 
     56#                                       @socket.clear 
     57#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     58#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     59                end 
     60        end 
     61 
     62end 
     63 
  • lang/ruby/chokan/branches/citrus/plugins/whois.rb

    r451 r6624  
    11 
    2 require 'chokan/plugin_base' 
    32require 'hpricot' 
    43 
    5 class Whois < Chokan::PluginBase 
    6         def initialize(config, chokan) 
     4class Whois < Citrus::Plugin 
     5        def initialize(*args) 
    76                super 
    87                @prefix = @config['prefix'] || 'whois ' 
     
    4039        end 
    4140end 
     41 
     42tests do 
     43        describe Whois do 
     44                before :all do 
     45                        @core   = DummyCore.new({}) 
     46                        @socket = @core.socket 
     47                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     48 
     49                        @plugin = Whois.new(@core, { "Whois" => { 
     50                        } }) 
     51                end 
     52 
     53                it "should reply correctly" do 
     54#                                       @socket.clear 
     55#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     56#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     57                end 
     58        end 
     59 
     60end 
     61 
  • lang/ruby/chokan/branches/citrus/plugins/wikipedia.rb

    r5864 r6624  
    11 
    22require 'rubygems' 
    3 require 'chokan/plugin_base' 
    43require 'uri' 
    54require 'net/http' 
    65require 'hpricot' 
    76 
    8 class Wikipedia < Chokan::PluginBase 
    9         def initialize(config, chokan) 
     7class Wikipedia < Citrus::Plugin 
     8        def initialize(*args) 
    109                super 
    1110                @prefix = @config['prefix'] || '\? *?' 
     
    4443        end 
    4544end 
     45 
     46tests do 
     47        describe Wikipedia do 
     48                before :all do 
     49                        @core   = DummyCore.new({}) 
     50                        @socket = @core.socket 
     51                        @prefix = Net::IRC::Prefix.new("foo!foo@localhsot") 
     52 
     53                        @plugin = Wikipedia.new(@core, { "Wikipedia" => { 
     54                        } }) 
     55                end 
     56 
     57                it "should reply correctly" do 
     58#                                       @socket.clear 
     59#                                       @plugin.on_privmsg(@prefix, "#test", "foo") 
     60#                                       @socket.pop.to_s.should == "NOTICE #test :Nice boat.\r\n" 
     61                end 
     62        end 
     63 
     64end 
     65