Skip to content

Commit

Permalink
Start a quick "how to ..." section
Browse files Browse the repository at this point in the history
This section is to address the growing amount of internal tools we have
built over time; it is an attempt at making them more discoverable in a
problem/solution format instead of a long list, plus a quick-start
guide.

This is in RST format so that we can make use of the table of contents
feature.
  • Loading branch information
mike-burns committed Apr 21, 2016
1 parent 00fe609 commit f9ce945
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Guides for getting things done, programming well, and programming in style.

* [Best Practices](/best-practices)
* [Code Review](/code-review)
* [How to](/how-to)
* [Protocol](/protocol)
* [Communication](/protocol/communication)
* [Git](/protocol/git)
Expand Down
55 changes: 55 additions & 0 deletions how-to/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
How do I ...
============

.. contents::

... start a new Rails app?
--------------------------

Use suspenders_:

.. code:: sh
$ gem install suspenders
$ suspenders the-name-of-your-project-here
$ cd the-name-of-your-project-here/
$ bin/setup
$ rake
.. _suspenders: https://github.com/thoughtbot/suspenders

... feature-test a Rails app's Javascript?
------------------------------------------

Use capybara-webkit_. In your ``Gemfile``:

.. code:: ruby
gem "capybara-webkit"
In ``spec/support/capybara_webkit.rb`` (for Rspec):

.. code:: ruby
Capybara.javascript_driver = :webkit
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
When writing a spec, you must set the ``:js`` flag for that test to make use of
capybara-webkit. For example, in ``spec/features/user_signs_in_spec.rb``:

.. code:: ruby
feature "Authentication", :js do
scenario "A user signing in" do
create(:user, email: "[email protected]", password: "sekrit")
sign_in_as email: "[email protected]", password: "sekrit"
expect(page).to have_text("Welcome!")
end
end
.. _capybara-webkit: https://github.com/thoughtbot/capybara-webkit

0 comments on commit f9ce945

Please sign in to comment.