Skip to content

Instantly share code, notes, and snippets.

@tamoot
Last active Oct 8, 2016
Embed
What would you like to do?
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