Sha256: c4bcff3d1eb7823817180d30fa3eba6fe0bb6e283c124b5d2586eaeafcbe296a
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'open_classes/kernel' require 'test_toolbox' describe Kernel do context :puts_eval do cases = [ { case_no: 1, case_title: 'no bind case', code: '8/4', expected: "8/4 # => 2\n" }, { case_no: 2, case_title: 'with bind case', code: '"hoge-#{message}"', bind: 'msg', expected: '"hoge-#{message}" # => "hoge-msg"' + "\n" } ] cases.each do |c| it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do begin case_before c # -- given -- message = c[:bind] if c[:bind] # -- when -- actual = capture_stdout { puts_eval c[:code], binding } # -- then -- expect(actual).to eq(c[:expected]) ensure case_after c end end def case_before(c) # implement each case before end def case_after(c) # implement each case after end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tbpgr_utils-0.0.151 | spec/open_classes/kernel/puts_eval_spec.rb |