Sha256: a3a95bc12608171a1ae09bf472f3fdac42ca1bba030b15b28756d5c7c1bb2d51

Contents?: true

Size: 848 Bytes

Versions: 5

Compression:

Stored size: 848 Bytes

Contents

require "spec_helper"
require "better_errors/repl/basic"

module BetterErrors
  module REPL
    describe Basic do
      let(:fresh_binding) {
        local_a = 123
        binding
      }
      
      let(:repl) { Basic.new fresh_binding }
      
      it "should evaluate ruby code in a given context" do
        repl.send_input("local_a = 456")
        fresh_binding.eval("local_a").should == 456
      end
      
      it "should return a tuple of output and the new prompt" do
        output, prompt = repl.send_input("1 + 2")
        output.should == "=> 3\n"
        prompt.should == ">>"
      end
      
      it "should not barf if the code throws an exception" do
        output, prompt = repl.send_input("raise Exception")
        output.should == "!! #<Exception: Exception>\n"
        prompt.should == ">>"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
better_errors-0.3.2 spec/better_errors/repl/basic_spec.rb
better_errors-0.3.0 spec/better_errors/repl/basic_spec.rb
better_errors-0.2.0 spec/better_errors/repl/basic_spec.rb
better_errors-0.1.1 spec/better_errors/repl/basic_spec.rb
better_errors-0.1.0 spec/better_errors/repl/basic_spec.rb