https://github.com/rubiii/rspec_attr_extensions
Ruby attribute extensions for RSpec
https://github.com/rubiii/rspec_attr_extensions
Last synced: about 2 months ago
JSON representation
Ruby attribute extensions for RSpec
- Host: GitHub
- URL: https://github.com/rubiii/rspec_attr_extensions
- Owner: rubiii
- Created: 2010-01-23T23:29:57.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-01-24T22:10:38.000Z (over 15 years ago)
- Last Synced: 2024-10-12T02:55:23.857Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 74.2 KB
- Stars: 16
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
Awesome Lists containing this project
README
h1. RSpec attr extensions
p. "RDoc":http://rdoc.info/projects/rubiii/rspec_attr_extensions | "Continuous Integration":http://runcoderun.com/rubiii/rspec_attr_extensions | "Metrics":http://getcaliper.com/caliper/project?repo=git://github.com/rubiii/rspec_attr_extensions.git
h2. Installation
bc. $ gem install rspec_attr_extensions
h2. An example
p. Let's test that TheHoff contains various attr_* methods.
class TheHoff
def initialize
@hair_style = "curly"
@smash_hit = "Looking for Freedom"
@date_of_birth = "July 17, 1952"
endattr_reader :smash_hit, :date_of_birth
attr_writer :smash_hitattr_accessor :hair_style
end
p. Load rspec_attr_extensions in your spec_helper file.
bc. require "spec"
require "rspec_attr_extensions"p. And use the test methods provided by this library to clean up your specs.
require "spec_helper"
describe TheHoff do
it_should_have_an_attr_reader_for :smash_hit, :date_of_birth
it_should_have_an_attr_writer_for :smash_hitit_should_have_an_attr_accessor_for :hair_style
end