spec/mixin_spec.rb in ronin-support-0.5.1 vs spec/mixin_spec.rb in ronin-support-0.5.2

- old
+ new

@@ -18,36 +18,34 @@ mixin { @var = 1 } end end context "when included" do - before(:all) do - @base = Class.new - @base.send :include, subject + let(:klass) do + Class.new.tap { |klass| klass.send :include, subject } end it "should include the mixed in modules" do - @base.should include(Mixins::Test1) - @base.should include(Mixins::Test2) + expect(klass).to include(Mixins::Test1) + expect(klass).to include(Mixins::Test2) end it "should evaluate the mixin block" do - @base.instance_variable_get("@var").should == 1 + expect(klass.instance_variable_get("@var")).to eq(1) end end context "when extended" do - before(:all) do - @base = Object.new - @base.send :extend, subject + let(:object) do + Object.new.tap { |obj| obj.extend(subject) } end it "should extend the mixed in modules" do - @base.should be_kind_of(Mixins::Test1) - @base.should be_kind_of(Mixins::Test2) + expect(object).to be_kind_of(Mixins::Test1) + expect(object).to be_kind_of(Mixins::Test2) end it "should evaluate the mixin block" do - @base.instance_variable_get("@var").should == 1 + expect(object.instance_variable_get("@var")).to eq(1) end end end