Sha256: 9c6099e4881f00073ea1b6529db673beaa9e23e4d548c1fdb5534351e4c98986

Contents?: true

Size: 859 Bytes

Versions: 2

Compression:

Stored size: 859 Bytes

Contents

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

describe UnlessFalseController 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/unless_false_spec.rb
param_accessible-0.0.1 spec/lib/unless_false_spec.rb