Skip to content
Browse files

docs

  • Loading branch information...
1 parent 0a9ac23 commit 909fa3b974d10ef3dffb60b323a8857f782e4fe2 @dchelimsky dchelimsky committed Jan 1, 2011
Showing with 53 additions and 5 deletions.
  1. +3 −2 features/.nav
  2. +40 −0 features/GettingStarted.md
  3. +1 −1 features/README.md
  4. +9 −2 features/controller_specs/README.md
View
5 features/.nav
@@ -1,6 +1,7 @@
+- GettingStarted.md (Getting started)
- Upgrade.md
-- Generators.md
-- Autotest.md
+- Generators.md (Rails generators)
+- Autotest.md (Autotest integration)
- transactional_examples.feature
- model_specs:
- errors_on.feature
View
40 features/GettingStarted.md
@@ -0,0 +1,40 @@
+Install Rails-3
+
+ $ gem install rails -v "~> 3.0.0"
+
+### Generate an app
+
+ $ rails new example
+ $ cd example
+
+### Add rspec-rails to the Gemfile
+
+ $ echo 'gem "rspec-rails", :group => [:development, :test]' >> Gemfile
+
+### Install the bundle
+
+ $ bundle install
+
+### Generate a scaffold
+
+ $ rails generate scaffold Widgets name:string
+
+This generates files in the `app` and `spec` directories. The files in the
+`app` directory are generated by Rails, and Rails delegates the generation of
+the files in the `spec` directory to RSpec.
+
+### Run migrations
+
+ $ rake db:migrate && rake db:test:prepare
+
+### Run RSpec
+
+ $ rake spec
+
+or
+
+ $ rspec spec
+
+If all went well, you should see output ending with:
+
+ 29 examples, 0 failures, 2 pending
View
2 features/README.md
@@ -1,5 +1,5 @@
rspec-rails extends Rails' built-in testing framework to support rspec examples
-for requests, controllers, models, views, and helpers.
+for requests, controllers, models, views, helpers, mailers and routing.
## Rails-3
View
11 features/controller_specs/README.md
@@ -1,3 +1,6 @@
+Controller specs live in `spec/controllers` or any example group with
+`:type => :controller`.
+
A controller spec is an RSpec wrapper for a Rails functional test
(ActionController::TestCase::Behavior). It allows you to simulate a single
http request in each example, and then specify expected outcomes, including:
@@ -9,7 +12,7 @@ http request in each example, and then specify expected outcomes, including:
To specify outcomes, you can use:
-* standard rspec matchers (e.g. `response.code.should eq(200)`)
+* standard rspec matchers (`response.code.should eq(200)`)
* standard test/unit assertions (`assert_equal 200, response.code`)
* rails assertions (`assert_response 200`)
* rails-specific matchers:
@@ -19,11 +22,15 @@ To specify outcomes, you can use:
## Conventions:
+### Controller
+
* pass the controller being specified to the outermost `describe` method.
describe AccountController do
# ...
+### Views
+
* by default, views are not rendered. See
[views are stubbed by default](controller-specs/views-are-stubbed-by-default) and
- [render_views](controller-specs/render-views) for details
+ [render_views](controller-specs/render-views) for details.

0 comments on commit 909fa3b

Please sign in to comment.
Something went wrong with that request. Please try again.