Skip to content

Commit

Permalink
Bring back new_spec.rb explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
Bounga committed Jan 17, 2016
1 parent 5ad2e64 commit c8f1d2c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions source/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,32 @@ describe Web::Views::Books::New do

rendered.must_include('There was a problem with your submission')
rendered.must_include('title is required')
rendered.must_include('author is required')
end
end
```

We should also update our feature spec to reflect this new behavior:

```ruby
# spec/web/features/add_book_spec.rb
require 'features_helper'

describe 'Books' do
# Spec written sooner removed from brevity

it 'displays list of errors when params contains errors' do
visit '/books/new'

within 'form#book-form' do
click_button 'Create'
end

current_path.must_equal('/books')

assert page.has_content?('There was a problem with your submission')
assert page.has_content?('title is required')
assert page.has_content?('author is required')
end
end
```
Expand Down

0 comments on commit c8f1d2c

Please sign in to comment.