Skip to content

Commit

Permalink
A few styling rules for view specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsvetomila Mihaylova committed Oct 20, 2011
1 parent d1aa78c commit 32584af
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -593,6 +593,21 @@ There also can be one steps file for all features for a particular object (`arti

### Views

* The directory structure of the view specs `spec/views` matches the one in `app/views`. For example the specs for the views in `app/views/users` are placed in `spec/views/users`.
* The naming convention for the view specs is adding `_spec.rb` to the view name, for example the view `_form.html.haml` has a corresponding spec `_form.html.haml_spec.rb`.
* `spec_helper.rb` need to be required in each view spec file.
* The outer `describe` block uses the path to the view without the `app/views` part. This is used by the `render` method when it is called without arguments.

```Ruby
# spec/views/articles/new.html.haml_spec.rb
require 'spec_helper'

describe "articles/new.html.html" do
# ...
end
```


### Controllers

* Mock the models and stub their methods. Testing the controller should not depend on the model creation.
Expand Down

0 comments on commit 32584af

Please sign in to comment.