Rails notes
Create a controller without tests.
rails generate controller {controller name} {views/methods} --no-test-frameworkCreate integration test
rails generate integration_test {test_name}Roll back a migration
rake db:rollbackRspec test for Mass Assign Vulnerbility (or attribute not being accessible):
describe "accessible attributes" do
it "should not allow access to **Attribute**" do
expect do
**Model**.new(**Attribute**: **attr value**)
end.to raise_error(ActiveModel::MassAssignmentSecurity::Error)
end
endAdding this too an rspec with capybara installed will open the page in your browser. Allows for easy debugging of failing tests.
save_and_open_pageAjax
Ajax is basically request-response without a page reload, done through javascript.