Rails notes
Create a controller without tests.
rails generate controller {controller name} {views/methods} --no-test-framework
Create integration test
rails generate integration_test {test_name}
Roll back a migration
rake db:rollback
Rspec 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
end
Adding this too an rspec with capybara installed will open the page in your browser. Allows for easy debugging of failing tests.
save_and_open_page
Ajax
Ajax is basically request-response without a page reload, done through javascript.