Sha256: 08b6bca2936a3bd450b585ef4bda832e869a0e02775149debcb486767e91d14b
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
require 'rib/test' require 'rib/core/underscore' shared :underscore do should 'set _' do setup mock(@shell).get_input{'_'} mock(@shell).get_input{'10**2'} mock(@shell).get_input{'_'} @shell.loop_once.should.eq [nil, nil] @shell.loop_once @shell.loop_once.should.eq [100, nil] end should 'not set _ if already there' do bound = Object.new def bound._ 'hey' end setup(bound) mock(@shell).get_input{'_'} mock(@shell).get_input{'10**2'} mock(@shell).get_input{'_'} @shell.loop_once.should.eq ['hey', nil] @shell.loop_once @shell.loop_once.should.eq ['hey', nil] end should 'set __' do setup stub(@shell).puts.with_any_args mock(@shell).get_input{'XD'} mock(@shell).get_input{'__'} @shell.loop_once @shell.loop_once.first.should.kind_of?(NameError) end end describe Rib::Underscore do behaves_like :rib def setup bound=Object.new @shell = Rib::Shell.new( :binding => bound.instance_eval{binding}).before_loop stub(@shell).puts(is_a(String)) end test_for Rib::Underscore do behaves_like :underscore end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rib-1.1.6 | test/core/test_underscore.rb |
rib-1.1.5 | test/core/test_underscore.rb |
rib-1.1.4 | test/core/test_underscore.rb |