Skip to content

Instantly share code, notes, and snippets.

View randalmaile's full-sized avatar

Randal Maile randalmaile

View GitHub Profile
## RSpec favorites_controller.rb
require 'spec_helper'
describe FavoritesController do
before :each do
@bookmark = create(:bookmark)
@favorite = create(:favorite)
end
require 'spec_helper'
describe BookmarksController do
before :each do
@bookmark = create(:bookmark)
@user = create(:user)
end
describe "GET #show" do
it "assigns the requested bookmark to @bookmark" do
get :show, id: @bookmark
@randalmaile
randalmaile / Final Bloccit Questions
Created January 11, 2014 20:48
Final Bloccit Questions
DEVISE
1. How to you get .update_attribute(:email, "new email") to work in rails console?
@randalmaile
randalmaile / TODO
Created January 9, 2014 08:08
TODO
1. WRITE TESTS FOR THE CONTROLLER - YOU'VE LEARNED ABOUT TESTING MODELS, NOW TEST THE CONTROLLERS!!!
@randalmaile
randalmaile / Bloccit - Destroying and Creating with Ajax
Created January 7, 2014 22:21
Bloccit - Destroying and Creating with Ajax
sdsdfsfd
@randalmaile
randalmaile / Bloccit - Testing Users
Last active January 2, 2016 13:09
Bloccit - Testing Users
1. When dealing with multiple instances of a class, or trying to grab all the instances of a class, (as with top_rated) it's important to ensure the database is properly cleaned between tests. We'll use the database_cleaner for that.
2.
@randalmaile
randalmaile / Bloccit - Popular Posts
Created January 7, 2014 22:19
Bloccit - Popular Posts
@randalmaile
randalmaile / Bloccit - Public Profiles
Last active January 2, 2016 13:09
Bloccit - Public Profiles
## Requirements:
1. Want to enable users to have a public profile page, where they can share:
a. Posts
b. Comments
2. Constrained by what topics are publicly viewable.
3.
@randalmaile
randalmaile / Bloccit - Another Interlude
Last active January 2, 2016 13:09
Bloccit - Another Interlude
## Here are some things we missed:
1. We should redirect users to the topics view after they sign-in;
2. The current password field should be removed from registration/edit so that users signing-in via Facebook can update their information without entering a password;
3. If a user has previously voted, we should change the up/down arrow icon to reflect that they have voted;
4. We'll take a look at updating a couple of default bootstrap colors;
5. We need to check that we have the proper permissions before sending emails based on favorited posts.
###Removing Password Requirements -To simplify the Edit User form (remove the password confirm field) and to remove password fields from FaceBook authenticated users
@randalmaile
randalmaile / Blocks, Procs and Lambdas
Last active January 2, 2016 08:49
Blocks, Procs and Lambdas
1. Blocks - seen it dozens of times:
a. Basic
``` a = [1,2,3]
a.map! do |n|
n**2
end
=> [1,4,9]
"Sending the map! method to an array instance with a block of code
```
b. Yield