Sha256: a5f41aef9f2d66f0712b5a656ca36cf157c7cfa2927b97deb70a369a5fbb4116
Contents?: true
Size: 1.3 KB
Versions: 4
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' require 'command_kit/program_name' describe CommandKit::ProgramName do module TestProgramName class TestCmd include CommandKit::ProgramName end end let(:command_class) { TestProgramName::TestCmd } let(:program_name) { 'foo' } before do @original_program_name = $PROGRAM_NAME $PROGRAM_NAME = program_name end describe ".program_name" do subject { command_class } it "must return $PROGRAM_NAME" do expect(subject.program_name).to eq(program_name) end context "when $PROGRAM_NAME is '-e'" do let(:program_name) { '-e' } it "must return nil" do expect(subject.program_name).to be(nil) end end context "when $PROGRAM_NAME is 'irb'" do let(:program_name) { 'irb' } it "must return nil" do expect(subject.program_name).to be(nil) end end context "when $PROGRAM_NAME is 'rspec'" do let(:program_name) { 'rspec' } it "must return nil" do expect(subject.program_name).to be(nil) end end end describe "#program_name" do subject { command_class.new } it "should be the same as .program_name" do expect(subject.program_name).to eq(command_class.program_name) end end after do $PROGRAM_NAME = @original_program_name end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
command_kit-0.2.2 | spec/program_name_spec.rb |
command_kit-0.2.1 | spec/program_name_spec.rb |
command_kit-0.2.0 | spec/program_name_spec.rb |
command_kit-0.1.0 | spec/program_name_spec.rb |