- Created at: mm/dd/yyyy
- Author: Name
You control a [PLAYER TYPE] in this [TOP DOWN / SIDE VIEW / ISOMETRIC] game where [USER INPUT TYPE] makes the player [DESCRIPTION OF PLAYER MOVEMENT].
\documentclass{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage{amsmath} | |
\begin{document} | |
\begin{align*} | |
x y& = k\\ | |
(x + \Delta x) (y - \Delta y)& = k\\ | |
(x + \Delta x) (y - \Delta y)& = x y |
# Rails helper config stuff... | |
# Because `let!' is always run before any `before` calls, you have to manually | |
# overide the constant in the rails helper | |
SomeClass.send :remove_const, 'FILE_NAME' | |
SomeClass.const_set 'FILE_NAME', 'spec/fixtures/files/something/cool.yml' |
class SomeModel < ApplicationRecord | |
validates :email, format: { | |
with: URI::MailTo::EMAIL_REGEXP, | |
message: 'requires a valid email format' | |
} | |
end |
<%= form_with model: @article do |form| %> | |
<div class="field"> | |
<%= form.label :title %> | |
<%= form.text_field :title, placeholder: 'Title' %> | |
</div> | |
<div class="field"> | |
<input id="article_content" type="hidden" name="article[content]" | |
value="<%= form.content %>"> | |
<trix-editor input="article_content"></trix-editor> |
class ApplicationController < ActionController::Base | |
# While in such a small app, this extraction into a concern seems unnecessary. | |
# I included this abstraction as an example of DRY and modular code.. | |
include SetRequest | |
end |
# test/system/article/post_test.rb | |
require 'application_system_test_case' | |
class Articles::PostTest < ApplicationSystemTestCase | |
setup do | |
sign_in_as users(:will) | |
visit articles_path | |
end | |
test 'post a new article' do |
# test/test_helper.rb | |
ENV['RAILS_ENV'] ||= 'test' | |
require_relative '../config/environment' | |
require 'rails/test_help' | |
# Be sure to add this line to include all support files | |
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } | |
class ActiveSupport::TestCase | |
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. |
# test/fixtures/articles.yml | |
trix_capybara: | |
title: Testing the Trix Editor with Capybara | |
content: <div>We are going to learn some cool stuff!</div> |
# test/support/capybara_helpers.rb | |
def fill_in_trix_editor(id, with:) | |
find(:xpath, "//trix-editor[@input='#{id}']").click.set(with) | |
end | |
def find_trix_editor(id) | |
find(:xpath, "//*[@id='#{id}']", visible: false) | |
end |