Sha256: e51432c5d6ca60f1a7aee4a05c51e9852ebcad70426a5be58e594b7e42909de0
Contents?: true
Size: 743 Bytes
Versions: 1
Compression:
Stored size: 743 Bytes
Contents
require 'spec_helper' describe Yema::Validator, "#valid?" do subject { validator.valid? } let(:validator) { described_class.new(rule, resource) } let(:rule) { mock('required_rule', attribute_name: :foo) } let(:resource) { mock('resource', foo: value) } before do resource.should_receive(:foo).and_return(value) end context "when the value is valid" do let(:value) { 'bar' } before do rule.should_receive(:matches?).with(value).and_return(true) end it { should be_true } end context "when the value is invalid" do let(:value) { nil } before do rule.should_receive(:matches?).with(value).and_return(false) end it { should be_false } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yema-0.0.1 | spec/unit/validator/valid_predicate_spec.rb |