PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/spec/plugins/gsub_spec.rb

https://github.com/Epictetus/termtter
Ruby | 18 lines | 17 code | 0 blank | 1 comment | 1 complexity | 7eea744aa3023e4a607e261d36562370 MD5 | raw file
  1. # -*- coding: utf-8 -*-
  2. require File.expand_path(File.dirname(__FILE__)) + '/../spec_helper'
  3. describe Termtter::Client, 'when the plugin gsub is loaded' do
  4. it 'plugin gsub' do
  5. f = nil
  6. Termtter::Client.should_receive(:register_hook).once do |params|
  7. f = params[:exec]
  8. end
  9. config.plugins.gsub.table = [[/^foo/, 'FOO'], ['bar']]
  10. Termtter::Client.plug 'gsub'
  11. f.should_not be_nil
  12. status_struct = Struct.new(:text)
  13. statuses = []
  14. statuses << status_struct.new('foobarbaz')
  15. f.call(statuses, nil)
  16. statuses[0].text.should == 'FOObaz'
  17. end
  18. end