Sha256: 7e53ac76e7b5a6d9f2691ed1388a912073a903588c514feeb85e7e5aa8766e55

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

require 'spec_helper'

describe Yema::Validator, "#errors" do

  subject { validator.errors }

  let(:validator) { described_class.new(rule, resource) }
  let(:rule)      { stub('rule')                        }
  let(:resource)  { stub('resource')                    }

  before do
    validator.should_receive(:valid?).and_return(valid)
  end

  context "when the attribute is valid" do
    let(:valid) { true }
    it_should_behave_like "valid resource"
  end

  context "when the attribute is invalid" do
    let(:valid) { false }
    it_should_behave_like "invalid resource"
    specify { subject.first.should be_kind_of(Yema::Error) }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yema-0.0.1 spec/unit/validator/errors_spec.rb