Sha256: f29173431482fd57a66b77401a3a0131929c27f1f27b4e927c7247c600d8ee02

Contents?: true

Size: 599 Bytes

Versions: 4

Compression:

Stored size: 599 Bytes

Contents

require 'spec_helper'
require 'shared_examples/chozo/config'

TestConfig = Class.new do
  include Chozo::Config

  attribute :name
  validates_presence_of :name

  attribute :job
end

describe Chozo::Config do
  it_behaves_like "Chozo::Config", TestConfig

  subject do
    TestConfig.new
  end

  describe "Validations" do
    it "is valid if all required attributes are specified" do
      subject.name = "reset"

      subject.should be_valid
    end

    it "is not valid if a required attribute is not specified" do
      subject.name = nil

      subject.should_not be_valid
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chozo-0.1.0 spec/unit/chozo/config_spec.rb
chozo-0.0.3 spec/unit/chozo/config_spec.rb
chozo-0.0.2 spec/unit/chozo/config_spec.rb
chozo-0.0.1 spec/unit/chozo/config_spec.rb