From 5351307cdcac2035cf32d280c69d7ea9aede9417 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Thu, 16 Apr 2015 18:16:49 +0000 Subject: [PATCH] Implement Client#moveresize --- lib/uh/wm/client.rb | 5 +++++ spec/uh/wm/client_spec.rb | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/uh/wm/client.rb b/lib/uh/wm/client.rb index 44c604d..69424c3 100644 --- a/lib/uh/wm/client.rb +++ b/lib/uh/wm/client.rb @@ -20,6 +20,11 @@ module Uh def wclass @wclass ||= @window.wclass end + + def moveresize + @window.moveresize @geo + self + end end end end diff --git a/spec/uh/wm/client_spec.rb b/spec/uh/wm/client_spec.rb index 62cf8ef..d9b7f61 100644 --- a/spec/uh/wm/client_spec.rb +++ b/spec/uh/wm/client_spec.rb @@ -2,7 +2,10 @@ module Uh module WM RSpec.describe Client do let(:geo) { Geo.new(0, 0, 640, 480) } - let(:window) { double 'window', to_s: 'wid', name: 'wname', wclass: 'wclass' } + let(:window) do + instance_spy Window, 'window', to_s: 'wid', + name: 'wname', wclass: 'wclass' + end subject(:client) { described_class.new window, geo } describe '#to_s' do @@ -34,6 +37,17 @@ module Uh expect(client.wclass).to eq window.wclass end end + + describe '#moveresize' do + it 'moveresizes the window with client geo' do + expect(window).to receive(:moveresize).with geo + client.moveresize + end + + it 'returns self' do + expect(client.moveresize).to be client + end + end end end end