tmattia/virtus-matchers — pull request #2 by jpmoral (2014-08-07 03:03:18+00:00)
Title: Add matcher for default values

Usage:
```
class Example
include Virtus.model
attribute :hello, String, default: "Hello"
attribute :hi_no_default, String
end
```

```
context 'checking for default' do
context "when default matches expected default" do
let(:matcher) { described_class.new(:hello, String).with_default("Hello") }

it 'matches' do
expect(matcher.matches?(Example)).to be true
end
end

context "when default does not match the expected default" do
let(:matcher) { described_class.new(:hello, String).with_default("Hala") }

it 'does not match' do
expect(matcher.matches?(Example)).to be false
end
end

context "there is an expected default, but none is set" do
let(:matcher) do
described_class.new(:hi_no_default, String).with_default("Hello")
end

it 'does not match' do
expect(matcher.matches?(Example)).to be false
end
end

it 'has a description' do
matcher = described_class.new(:hello, String).with_default("Hello")
matcher.matches?(Example)
expect(matcher.description).to eq 'have attribute hello of type String with default "Hello"'
end
end
```