AccessibleAttribute Matcher build status

About

Use Rails 3 accessible_attributes reflection to test attr_accessible / attr_protected.

URLs:

Installation

Add to your Gemfile and run the bundle command to install it.

  gem 'accessible_attribute_matcher'

Requires Ruby 1.9.2 or later.

Usage

  class Foo < ActiveRecord::Base
    attr_accessible :field_a
    attr_accessible :field_b, as: [:admin]
    attr_protected  :field_c
  end

  require 'spec_helper'

  describe Foo do

    it { should     expose(:field_a) }
    it { should_not expose(:field_b).to(:default) }
    it { should     expose(:field_b).to(:admin) }
    it { should_not expose(:field_c) }

  end