Skip to content

Commit

Permalink
Stub a screen size for test_context
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Jan 19, 2021
1 parent 6f510fa commit ea87592
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions test/irb/test_color.rb
Expand Up @@ -19,7 +19,6 @@ class TestColor < Test::Unit::TestCase
CYAN = "\e[36m"

def setup
super
@get_screen_size = Reline.method(:get_screen_size)
Reline.instance_eval { undef :get_screen_size }
def Reline.get_screen_size
Expand All @@ -30,7 +29,6 @@ def Reline.get_screen_size
def teardown
Reline.instance_eval { undef :get_screen_size }
Reline.define_singleton_method(:get_screen_size, @get_screen_size)
super
end

def test_colorize_code
Expand Down
11 changes: 11 additions & 0 deletions test/irb/test_context.rb
Expand Up @@ -42,6 +42,17 @@ def setup
IRB.conf[:VERBOSE] = false
workspace = IRB::WorkSpace.new(Object.new)
@context = IRB::Context.new(nil, workspace, TestInputMethod.new)

@get_screen_size = Reline.method(:get_screen_size)
Reline.instance_eval { undef :get_screen_size }
def Reline.get_screen_size
[36, 80]
end
end

def teardown
Reline.instance_eval { undef :get_screen_size }
Reline.define_singleton_method(:get_screen_size, @get_screen_size)
end

def test_last_value
Expand Down

0 comments on commit ea87592

Please sign in to comment.