Created
June 2, 2011 19:11
-
-
Save itspriddle/1005075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec::Matchers.define :have_attr_accessor do |attribute| | |
match do |object| | |
object.respond_to?(attribute) && object.respond_to?("#{attribute}=") | |
end | |
description do | |
"have attr_writer :#{attribute}" | |
end | |
end | |
RSpec::Matchers.define :have_attr_reader do |attribute| | |
match do |object| | |
object.respond_to? attribute | |
end | |
description do | |
"have attr_reader :#{attribute}" | |
end | |
end | |
RSpec::Matchers.define :have_attr_writer do |attribute| | |
match do |object| | |
object.respond_to? "#{attribute}=" | |
end | |
description do | |
"have attr_writer :#{attribute}" | |
end | |
end |
Author
itspriddle
commented
Jun 2, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment