From 722533a6358a57bc0fa38d8819b352fef928b34f Mon Sep 17 00:00:00 2001 From: Postmodern Date: Sat, 6 Jul 2024 14:18:49 -0700 Subject: [PATCH] Added specs for the default values of `--host` and `--port` options. --- spec/cli/commands/dns_spec.rb | 12 ++++++++++++ spec/cli/commands/http_spec.rb | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/spec/cli/commands/dns_spec.rb b/spec/cli/commands/dns_spec.rb index 331ec78..da4fa29 100644 --- a/spec/cli/commands/dns_spec.rb +++ b/spec/cli/commands/dns_spec.rb @@ -107,5 +107,17 @@ end end end + + context "when no options are given" do + let(:argv) { [] } + + it "must default options[:host] to '0.0.0.0'" do + expect(subject.options[:host]).to eq('0.0.0.0') + end + + it "must default options[:port] to 53" do + expect(subject.options[:port]).to eq(53) + end + end end end diff --git a/spec/cli/commands/http_spec.rb b/spec/cli/commands/http_spec.rb index 04fa032..cec0ffa 100644 --- a/spec/cli/commands/http_spec.rb +++ b/spec/cli/commands/http_spec.rb @@ -107,5 +107,17 @@ end end end + + context "when no options are given" do + let(:argv) { [] } + + it "must default options[:host] to '0.0.0.0'" do + expect(subject.options[:host]).to eq('0.0.0.0') + end + + it "must default options[:port] to 8080" do + expect(subject.options[:port]).to eq(8080) + end + end end end