From ee2cf875b184f8a0dbee79b7c0b93f163a65dcf4 Mon Sep 17 00:00:00 2001 From: Cyril Mougel Date: Tue, 18 Sep 2012 10:54:45 +0200 Subject: [PATCH] improve the readme and alias have_attribute and have_attributes --- README.md | 16 ++++++++++++++++ lib/virtus-rspec/virtus_attribute.rb | 1 + 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index 854cb3f..a6e98e9 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,22 @@ RSpec.configure do |configuration| end ``` +You have now access to `have_attribute` matcher. + +``` +class Post + include Virtus + attribute :title, String + attribute :first_name, String + attribute :last_name, String +end + +describe Post do + it { should have_attribute(:title) } + it { should have_attributes(:first_name, :last_name) } +end +``` + ## Contributing 1. Fork it diff --git a/lib/virtus-rspec/virtus_attribute.rb b/lib/virtus-rspec/virtus_attribute.rb index c42e2eb..496ebe1 100644 --- a/lib/virtus-rspec/virtus_attribute.rb +++ b/lib/virtus-rspec/virtus_attribute.rb @@ -34,5 +34,6 @@ def description def have_attributes(*args) HaveAttributeMatcher.new(*args) end + alias :have_attribute :have_attributes end end