require 'spec_helper' describe Yema::Rule::Format, '#errors' do subject { rule.errors(resource) } let(:rule) { described_class.new(attribute, options) } let(:resource) { stub('resource', attribute => value) } let(:attribute) { :foo } let(:options) { { format: /foo/ } } [ 'foo', 'afoo', 'fooa', 'afooa', ].each do |value| it_behaves_like "valid resource", value end it_behaves_like "invalid resource", 'abcdds' end