Commit c2d9ed8
committed
Update rails_template and add spec*
Add `validates_uniqueness_of :last_name` to *Author* model, because the
original `validates_presence_of :name` barely works.
```ruby
context "with invalid data insert" do
it "should render error" do
upload_file!(:authors_invalid_db)
expect(page).to have_content "Error:"
expect(Author.count).to eq(0)
end
end
```
The spec above catches an `Error: SQLite
3::ConstraintException: column name is not unique`, the really
constraint is on DB level.
```ruby
add_index "authors", ["name"], name: "index_authors_on_name", unique:
true
````
The option `:batch_transaction` controls the transaction on
model level, so I've add an rspec context "with invalid data insert on model
validation".1 parent d40df13 commit c2d9ed8
File tree
3 files changed
+33
-3
lines changed- spec
- fixtures/files
- support
3 files changed
+33
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
| 296 | + | |
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
303 | 330 | | |
304 | 331 | | |
305 | 332 | | |
| |||
402 | 429 | | |
403 | 430 | | |
404 | 431 | | |
405 | | - | |
| 432 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
0 commit comments