Skip to content

Instantly share code, notes, and snippets.

@tamoot
Last active October 8, 2016 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamoot/150810e3a5c40ec840a52bf9e23bae82 to your computer and use it in GitHub Desktop.
Save tamoot/150810e3a5c40ec840a52bf9e23bae82 to your computer and use it in GitHub Desktop.
schtasksコマンド用serverspec
# frozen_string_literal: true
source "https://rubygems.org"
gem "serverspec", "2.36.1"
# code:utf-8
require 'spec_helper'
# schtasksコマンド出力に対応したエンコーディングに
schedule_type = "スケジュールの種類".encode("Windows-31J")
logon = "ログオン時".encode("Windows-31J")
task = "実行するタスク".encode("Windows-31J")
#
# ログイン時にctl-capsを入替えるスケジューラの確認
#
context "Scheduler registration for yamy.exe" do
describe command("schtasks /query /v /fo list /tn yamy") do
its(:exit_status) { should eq 0 }
#実行するタスク
its(:stdout) do
should match /^#{task}: +Z:\\App\\yamy-0.03\\yamy.exe/
end
#スケジュールの種類
its(:stdout) do
should match /^#{schedule_type}: +#{logon}/
end
#実行ユーザー
its(:stdout) do
should match /^#{run_as_user}: +tamoot/
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment