spec/printing/indent_spec.rb in command_kit-0.2.0 vs spec/printing/indent_spec.rb in command_kit-0.2.1

- old
+ new

@@ -10,18 +10,20 @@ let(:command_class) { TestIndent::TestCommand } subject { command_class.new } describe "#initialize" do - it "must initialize @indent to 0" do - expect(subject.instance_variable_get('@indent')).to eq(0) + it "must initialize #indent to 0" do + expect(subject.indent).to eq(0) end context "when the class has a superclass" do module TestIndent class TestSuperCommand + attr_reader :var + def initialize(var: 'default') @var = var end end @@ -34,23 +36,23 @@ end let(:command_class) { TestIndent::TestSubCommand } it "must initialize @indent to 0" do - expect(subject.instance_variable_get('@indent')).to eq(0) + expect(subject.indent).to eq(0) end it "must call super()" do - expect(subject.instance_variable_get('@var')).to eq('default') + expect(subject.var).to eq('default') end context "and additional keyword arguments are given" do let(:var) { 'foo' } subject { command_class.new(var: var) } it "must call super() with the additional keyword arguments" do - expect(subject.instance_variable_get('@var')).to eq(var) + expect(subject.var).to eq(var) end end end end