forked from thoughtbot/guides
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
00fe609
commit f9ce945
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |