0.0
No commit activity in last 3 years
No release in over 3 years
rspec matchers for kwalify to help you validate yaml files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

RSpec-Kwalify travis-ci

RSpec-Kwalify is a custom RSpec matcher to help you use Kwalify, a yaml validation gem, in RSpec.

Instead of having tests like this:

it "should have 2 validation errors" do
  errors = validator.validate(load_yaml("empty.yml"))
  errors.size.should == 2
  errors.each do |error|
    error.is_a?(Kwalify::ValidationError).should be_true
  end
end

You can use the more readable

it "should have 2 errors" do
  validator.validate(asset("empty.yml")).should have_validation_error(2)
end

All you need to do is to add this to your Gemfile

group :development, :test do
  gem "rspec-kwalify"
end

Examples

it "should have 2 errors" do
  validator.validate(asset("empty.yml")).should have_error(2)
end

it "should have 'foo' key" do
  validator.validate(asset("empty.yml")).should have_error(/key 'foo:' is required/)
end

it "should have validation error" do
  validator.validate(asset("empty.yml")).should have_validation_error
end