Sha256: 885428ad5a5ecddd46896a6d9814e88ae0fcb6baa01bdd94f62527a7a23a786d

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

# Basic class method specs

require 'lib/maintain'

describe Maintain do
  before :each do
    class MaintainTest
      attr_accessor :existant_attribute
      extend Maintain
    end
  end

  # Basic overview / class methods
  it "should extend things that include it" do
    MaintainTest.should respond_to(:maintain)
  end

  it "should alias the maintain method as `maintains`" do
    MaintainTest.should respond_to(:maintains)
  end

  it "should accept a block" do
    lambda {
      MaintainTest.maintain :non_existant_attribute do
        
      end
    }.should_not raise_error
  end

  it "should store a reference to all of the defined states in the class" do
    MaintainTest.maintain :non_existant_attribute
    MaintainTest.send(:maintainers)[:non_existant_attribute].should be_instance_of(Maintain::Maintainer)
  end

  it "should define accessors for non-existant attributes" do
    MaintainTest.maintain :non_existant_attribute
    MaintainTest.new.should respond_to('non_existant_attribute', 'non_existant_attribute=')
  end

  it "shouldn't care about existant attributes" do
    lambda {
      MaintainTest.maintain :existant_attribute
    }.should_not raise_error
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
maintain-0.1.6 spec/maintain_spec.rb
maintain-0.1.5 spec/maintain_spec.rb
maintain-0.1.4 spec/maintain_spec.rb
maintain-0.1.3 spec/maintain_spec.rb
maintain-0.1.2 spec/maintain_spec.rb