Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Use reflection to spec ActiveModel attr_accessible

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

AccessibleAttribute Matcher build status code climate

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
Something went wrong with that request. Please try again.