Sha256: 4b84a58dc942a319adff1699698f5522355b7cb9cff643daacdde5145bc85d79

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

# Basic class method specs

require 'spec_helper'
require '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

6 entries across 6 versions & 1 rubygems

Version Path
maintain-0.2.23 spec/maintain_spec.rb
maintain-0.2.22 spec/maintain_spec.rb
maintain-0.2.21 spec/maintain_spec.rb
maintain-0.2.20 spec/maintain_spec.rb
maintain-0.2.19 spec/maintain_spec.rb
maintain-0.2.18 spec/maintain_spec.rb