spec/arguments/argument_spec.rb in command_kit-0.1.0.pre1 vs spec/arguments/argument_spec.rb in command_kit-0.1.0.pre2

- old
+ new

@@ -1,43 +1,23 @@ require 'spec_helper' require 'command_kit/arguments/argument' describe Arguments::Argument do let(:name) { :foo } - let(:type) { String } let(:usage) { 'FOO' } - let(:default) { 'foo' } let(:required) { true } let(:repeats) { false } let(:desc) { 'Foo argument' } subject do - described_class.new name, type: type, - usage: usage, - default: default, + described_class.new name, usage: usage, required: required, repeats: repeats, desc: desc end describe "#initialize" do - context "when the type: keyword is given" do - subject { described_class.new(name, type: type, desc: desc) } - - it "must set #type" do - expect(subject.type).to eq(type) - end - end - - context "when the type: keyword is not given" do - subject { described_class.new(name, desc: desc) } - - it "default #type to String" do - expect(subject.type).to eq(String) - end - end - context "when the usage: keyword is given" do subject { described_class.new(name, usage: usage, desc: desc) } it "must include usage: in #usage" do expect(subject.usage).to include(usage) @@ -50,26 +30,10 @@ it "should use uppercased argument name in #usage" do expect(subject.usage).to include(name.to_s.upcase) end end - context "when the default: keyword is given" do - subject { described_class.new(name, default: default, desc: desc) } - - it "must set #default" do - expect(subject.default).to eq(default) - end - end - - context "when the default: keyword is not given" do - subject { described_class.new(name, desc: desc) } - - it "default #default to String" do - expect(subject.default).to eq(nil) - end - end - context "when the required: keyword is given" do subject { described_class.new(name, required: required, desc: desc) } it "must set #required" do expect(subject.required).to eq(required) @@ -86,18 +50,18 @@ context "when the repeats: keyword is given" do subject { described_class.new(name, repeats: repeats, desc: desc) } it "must set #repeats" do - expect(subject.repeats).to eq(repeats) + expect(subject.repeats?).to eq(repeats) end end context "when the repeats: keyword is not given" do subject { described_class.new(name, desc: desc) } it "default #repeats to String" do - expect(subject.repeats).to eq(false) + expect(subject.repeats?).to eq(false) end end context "when the desc: keyword is given" do subject { described_class.new(name, desc: desc) }