This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test for one model: | |
it "Should protect id from mass assignment" do | |
attributes = @user.attributes | |
attributes['id'] = 42 | |
lambda do | |
User.create(attributes).id.should_not equal 42 | |
end.should raise_error ActiveModel::MassAssignmentSecurity::Error | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'spork' | |
Spork.prefork do | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe User do | |
before { @user = FactoryGirl.build :user } | |
it "should have a factory ready to test" do | |
@user.should be_valid | |
end | |
end |
NewerOlder