Sha256: 71eeb315a4ee146878ea4718ef1682bab2cb197a57dc212c69a29df4024aed95

Contents?: true

Size: 854 Bytes

Versions: 2

Compression:

Stored size: 854 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe IfTrueController do
  include RSpec::Rails::ControllerExampleGroup
  
  it "should allow valid attributes" do
    post :create, :foo => "hi"
    response.code.should == "200"
  end
  
  it "should disallow invalid attributes" do
    begin
      post :create, :nuts => "hi"
      raise "should fail"
    rescue ParamAccessible::Error => e
      e.inaccessible_params.should == %w(nuts)
    end
  end
  
  it "should allow valid nested attributes" do
    post :update, :bar => {:baz => 'hi'}
    response.code.should == "200"
  end
  
  it "should disallow invalid nested attributes" do
    begin
      post :update, :bar => {:foo => 'hi'}
      raise "should fail"
    rescue ParamAccessible::Error => e
      e.inaccessible_params.should == %w(bar[foo])
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
param_accessible-0.0.2 spec/lib/if_true_spec.rb
param_accessible-0.0.1 spec/lib/if_true_spec.rb