brew install redis
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents/
-- LATERAL was introduced in PostgreSQL 9.3 | |
-- Considering the last submission | |
SELECT employees.*, | |
COALESCE(scores.value, -6) value | |
FROM employees | |
LEFT JOIN LATERAL ( | |
SELECT scores.* | |
FROM scores | |
WHERE scores.employee_id = employees.id |
require 'test_helper' | |
class CommentsControllerTest < ActionDispatch::IntegrationTest | |
test '#create stores a comment for a given post' do | |
my_post = Post.create(title: 'My post', content: 'My new blog post') | |
post post_comments_path(my_post), params: { comment: { content: 'Nice post!' } } | |
assert_redirected_to post_path(my_post) | |
assert_equal 'Comment created!', flash[:notice] |
require 'test_helper' | |
class CommentTest < ActiveSupport::TestCase | |
test 'it is not valid without a post' do | |
comment = Comment.new | |
refute comment.valid? | |
assert_equal ['must exist'], comment.errors.messages[:post] | |
end |
require 'test_helper' | |
class PostsControllerTest < ActionDispatch::IntegrationTest | |
test '#index returns a list of all available posts' do | |
get posts_path | |
assert_response :success | |
end | |
test '#new returns a posts form' do |
require 'test_helper' | |
class PostTest < ActiveSupport::TestCase | |
test 'it is not valid without title' do | |
post = Post.new | |
refute post.valid? | |
assert_equal ["can't be blank"], post.errors.messages[:title] | |
end |