Sha256: ea914f97a5cb7c8ec0bc7682d2c9abe62af4ecae06686886807aea37e2c48791

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

require_relative "../test-util"

class VariableHolderA
  include Util::VariableHoldable
  include_variable true
end

class VariableHolderB
  include Util::VariableHoldable
  include_variable false
end

class VariableHolderC
  include Util::VariableHoldable
  hold_variable :a
  attr_accessor :a
end

class VariableHolderD
  include Util::VariableHoldable
  hold_variables :a, :b, :c
  attr_accessor :a
  attr_accessor :b
  attr_accessor :c
end

describe "Pione::Util::VariableHoldable" do
  describe "VariableHolderA" do
    it "should include variable" do
      VariableHolderA.new.should.include_variable
    end
  end

  describe "VariableHolderB" do
    it "should not include variable" do
      VariableHolderB.new.should.not.include_variable
    end
  end

  describe "VariableHolderC" do
    it "should include variable" do
      c = VariableHolderC.new
      c.a = VariableHolderA.new
      c.should.include_variable
    end

    it "should not include variable" do
      c = VariableHolderC.new
      c.should.not.include_variable
      c.a = VariableHolderB.new
      c.should.not.include_variable
    end
  end

  describe "VariableHolderD" do
    it "should include variable" do
      d = VariableHolderD.new
      d.a = VariableHolderA.new
      d.should.include_variable
    end

    it "should not include variable" do
      d = VariableHolderD.new
      d.should.not.include_variable
      d.a = VariableHolderB.new
      d.should.not.include_variable
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pione-0.2.2 test/util/spec_variable-holdable.rb
pione-0.2.1 test/util/spec_variable-holdable.rb
pione-0.2.0 test/util/spec_variable-holdable.rb