spec/fusuma/plugin/plugin/executors/wmctrl_executor_spec.rb in fusuma-plugin-wmctrl-0.4.1 vs spec/fusuma/plugin/plugin/executors/wmctrl_executor_spec.rb in fusuma-plugin-wmctrl-0.4.2
- old
+ new
@@ -40,12 +40,12 @@
describe '#execute' do
it 'detach' do
pid = rand(20)
allow(POSIX::Spawn)
.to receive(:spawn).with(@executor.search_command(@event))
- .and_return pid
-
+ .and_return pid
+
expect(Process).to receive(:detach).with(pid)
@executor.execute(@event)
end
end
@@ -62,11 +62,10 @@
it { expect(@executor.executable?(@event)).to be_falsey }
end
end
describe '#search_command' do
-
context "when workspace: 'prev'" do
around do |example|
ConfigHelper.load_config_yml = <<~CONFIG
dummy:
1:
@@ -337,37 +336,36 @@
.to match(/wmctrl -c :ACTIVE:/)
end
end
describe 'wrap_navigation: true' do
-
context "when workspace: 'prev' and current workspace 0" do
around do |example|
ConfigHelper.load_config_yml = <<~CONFIG
dummy:
1:
direction:
workspace: 'prev'
- plugin:
+ plugin:
executors:
wmctrl_executor:
wrap-navigation: true
CONFIG
-
+
example.run
-
+
Config.custom_path = nil
end
it 'should return wmctrl command with an index last workspace' do
current_workspace = 0
total_workspaces = 3
-
+
allow(WmctrlExecutor::Workspace)
.to receive(:workspace_values)
.and_return([current_workspace, total_workspaces])
-
+
expect(@executor.search_command(@event))
.to match(/wmctrl -s #{total_workspaces - 1}/)
end
end
@@ -376,99 +374,98 @@
ConfigHelper.load_config_yml = <<~CONFIG
dummy:
1:
direction:
workspace: 'next'
- plugin:
+ plugin:
executors:
wmctrl_executor:
wrap-navigation: true
CONFIG
-
+
example.run
-
+
Config.custom_path = nil
end
-
+
it 'should return wmctrl command with an index of first workspace' do
current_workspace = 3
total_workspaces = 4
-
+
allow(WmctrlExecutor::Workspace)
.to receive(:workspace_values)
.and_return([current_workspace, total_workspaces])
expect(@executor.search_command(@event))
.to match(/wmctrl -s 0/)
end
end
-
+
context "when window: 'prev' and current workspace has index 0" do
around do |example|
ConfigHelper.load_config_yml = <<~CONFIG
dummy:
1:
direction:
window: 'prev'
- plugin:
+ plugin:
executors:
wmctrl_executor:
wrap-navigation: true
CONFIG
-
+
example.run
-
+
Config.custom_path = nil
end
-
+
it 'should return wmctrl command with index of last workspace' do
current_workspace = 0
total_workspaces = 5
-
+
allow(WmctrlExecutor::Workspace)
.to receive(:workspace_values)
.and_return([current_workspace, total_workspaces])
expect(@executor.search_command(@event))
.to match(/wmctrl -r :ACTIVE: -t #{total_workspaces - 1}/)
expect(@executor.search_command(@event))
.to match(/wmctrl -s #{total_workspaces - 1}/)
end
end
-
+
context "when window: 'next' and current workspace is last" do
around do |example|
ConfigHelper.load_config_yml = <<~CONFIG
dummy:
1:
direction:
window: 'next'
- plugin:
+ plugin:
executors:
wmctrl_executor:
wrap-navigation: true
CONFIG
-
+
example.run
-
+
Config.custom_path = nil
end
-
+
it 'should return wmctrl command with index of first workspace' do
current_workspace = 4
total_workspaces = 5
-
+
allow(WmctrlExecutor::Workspace)
.to receive(:workspace_values)
.and_return([current_workspace, total_workspaces])
expect(@executor.search_command(@event))
.to match(/wmctrl -r :ACTIVE: -t 0/)
expect(@executor.search_command(@event))
.to match(/wmctrl -s 0/)
end
end
-
end
end
end
end
end