Sha256: 9c436037889f4d43c6bd134b21d24e5927ef51d0e3d93b769b63dd9e7e2e02df

Contents?: true

Size: 1.92 KB

Versions: 2

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'

describe MountDoc::Config do
  describe :auto_mount do
    subject{ MountDoc::Config.auto_mount? }
    it("default: false") { should be_false }

    it("writable boolean") {
      MountDoc::Config.auto_mount = 1
      should be_true
    }
  end

  describe :auto_mount_path do
    subject { MountDoc::Config.auto_mount_path }

    it("default: /doc"){ should == '/doc' }

    it('writable string'){
      MountDoc::Config.auto_mount_path = 1
      should == '1'
    }
  end

  describe :visible_private_methods do
    subject{ MountDoc::Config.visible_private_methods? }

    it("default: false"){ should be_false }

    it("writable boolean"){
      MountDoc::Config.visible_private_methods = 1
      should be_true
    }
  end

  describe :visible_protected_methods do
    subject{ MountDoc::Config.visible_protected_methods? }

    it("default: false"){ should be_false }

    it("writable boolean"){
      MountDoc::Config.visible_protected_methods = 1
      should be_true
    }
  end

  describe :visible_components do
    subject{ MountDoc::Config.visible_components }

    it("default: MountDoc::Config::Components"){ should == MountDoc::Config::Components }

    it("writable MountDoc::Config::Components"){
      MountDoc::Config.visible_components = [:urls, :invalid, :controllers]
      should == [:urls, :controllers]
    }
  end

  describe :doc_file_path do
    subject{ MountDoc::Config.doc_file_path }

    it("default: 'doc'"){ should == 'doc' }
  end

  describe :defaults! do
    subject{ MountDoc::Config }

    it("set default"){
      subject.visible_protected_methods = true
      subject.defaults!
      subject.visible_protected_methods.should be_false
    }
  end

  describe :cool_config do
    it "change config" do
      lambda{
        MountDoc.config do |conf|
          conf.visible_components = [:files]
        end
      }.should change(MountDoc::Config, :visible_components).to([:files])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mount_doc-1.0.0 spec/lib/mount_doc/config_spec.rb
mount_doc-0.0.3 spec/lib/mount_doc/config_spec.rb