No commit activity in last 3 years
No release in over 3 years
Ruby attribute extensions for RSpec
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.8
 Project Readme

RSpec attr extensions

RDoc | Continuous Integration | Metrics

Installation

$ gem install rspec_attr_extensions

An example

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"
  end

  attr_reader :smash_hit, :date_of_birth
  attr_writer :smash_hit

  attr_accessor :hair_style

end

Load rspec_attr_extensions in your spec_helper file.

require "spec"
require "rspec_attr_extensions"

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_hit

  it_should_have_an_attr_accessor_for :hair_style

end