Skip to content

Instantly share code, notes, and snippets.


Philip Ingram pjammer

View GitHub Profile
View snippet.rb
class Post
has_many :comments
has_many :tags, :as => :taggable
class Comment
belongs_to :post
has_many :tags, :as => :taggable
class Tag
belongs_to :taggable, :polymorphic => true
View snippet.rb
require 'test_helper'
class AuthenticationTest < ActionController::IntegrationTest
def log_and_say(user, arg)
login_on_admin(user.username, user.password)
assert_content arg
test "Login on admin with valid username, password and role" do
user =
log_and_say(user, "Welcome #{user.username}, logged in as #{user.role}")