books 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/app/assets/javascripts/{book → books}/application.js +0 -0
- data/app/assets/stylesheets/{book → books}/application.css +0 -0
- data/app/controllers/{book → books}/application_controller.rb +1 -1
- data/app/helpers/{book → books}/application_helper.rb +1 -1
- data/app/views/layouts/books/application.html.erb +14 -0
- data/config/routes.rb +1 -4
- data/lib/books.rb +4 -0
- data/lib/{book → books}/engine.rb +2 -2
- data/lib/books/version.rb +3 -0
- data/lib/tasks/{book_tasks.rake → books_tasks.rake} +1 -1
- data/test/books_test.rb +7 -0
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/initializers/secret_token.rb +1 -1
- data/test/dummy/config/routes.rb +1 -1
- metadata +32 -41
- data/app/assets/javascripts/book/books.js +0 -2
- data/app/assets/stylesheets/book/books.css +0 -4
- data/app/assets/stylesheets/scaffold.css +0 -56
- data/app/controllers/book/books_controller.rb +0 -87
- data/app/helpers/book/books_helper.rb +0 -4
- data/app/models/book/book.rb +0 -5
- data/app/views/book/books/_form.html.erb +0 -33
- data/app/views/book/books/edit.html.erb +0 -6
- data/app/views/book/books/index.html.erb +0 -29
- data/app/views/book/books/new.html.erb +0 -5
- data/app/views/book/books/show.html.erb +0 -25
- data/app/views/layouts/book/application.html.erb +0 -14
- data/db/migrate/20130126052634_create_book_books.rb +0 -12
- data/lib/book.rb +0 -4
- data/lib/book/version.rb +0 -3
- data/test/book_test.rb +0 -7
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +0 -25
- data/test/dummy/log/development.log +0 -11
- data/test/fixtures/book/books.yml +0 -13
- data/test/functional/book/books_controller_test.rb +0 -51
- data/test/unit/book/book_test.rb +0 -9
- data/test/unit/helpers/book/books_helper_test.rb +0 -6
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
data/Rakefile
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Books</title>
|
5
|
+
<%= stylesheet_link_tag "books/application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "books/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/config/routes.rb
CHANGED
data/lib/books.rb
ADDED
data/test/books_test.rb
ADDED
@@ -4,4 +4,4 @@
|
|
4
4
|
# If you change this key, all old signed cookies will become invalid!
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token = '
|
7
|
+
Dummy::Application.config.secret_token = '92fe454c835c78b09c801670ec2d3702e177b5c5518af815889ac5e1a6ec5954bb82a6091b3389331a98a516c7b5664851c50ece5459bc84be530d7dd7d5b73c'
|
data/test/dummy/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,39 +27,43 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.2.11
|
30
|
-
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: sqlite3
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Read and upload e-books. Distributed as Rails mountable engine
|
31
47
|
email:
|
32
48
|
- zj137@163.com
|
33
49
|
executables: []
|
34
50
|
extensions: []
|
35
51
|
extra_rdoc_files: []
|
36
52
|
files:
|
37
|
-
- app/
|
38
|
-
- app/
|
39
|
-
- app/
|
40
|
-
- app/
|
41
|
-
- app/
|
42
|
-
- app/views/book/books/edit.html.erb
|
43
|
-
- app/views/book/books/_form.html.erb
|
44
|
-
- app/assets/javascripts/book/books.js
|
45
|
-
- app/assets/javascripts/book/application.js
|
46
|
-
- app/assets/stylesheets/scaffold.css
|
47
|
-
- app/assets/stylesheets/book/books.css
|
48
|
-
- app/assets/stylesheets/book/application.css
|
49
|
-
- app/helpers/book/application_helper.rb
|
50
|
-
- app/helpers/book/books_helper.rb
|
51
|
-
- app/controllers/book/books_controller.rb
|
52
|
-
- app/controllers/book/application_controller.rb
|
53
|
+
- app/views/layouts/books/application.html.erb
|
54
|
+
- app/assets/javascripts/books/application.js
|
55
|
+
- app/assets/stylesheets/books/application.css
|
56
|
+
- app/helpers/books/application_helper.rb
|
57
|
+
- app/controllers/books/application_controller.rb
|
53
58
|
- config/routes.rb
|
54
|
-
-
|
55
|
-
- lib/
|
56
|
-
- lib/
|
57
|
-
- lib/
|
58
|
-
-
|
59
|
+
- lib/books.rb
|
60
|
+
- lib/books/version.rb
|
61
|
+
- lib/books/engine.rb
|
62
|
+
- lib/tasks/books_tasks.rake
|
63
|
+
- MIT-LICENSE
|
59
64
|
- Rakefile
|
60
65
|
- README.md
|
61
66
|
- test/dummy/config.ru
|
62
|
-
- test/dummy/log/development.log
|
63
67
|
- test/dummy/config/boot.rb
|
64
68
|
- test/dummy/config/application.rb
|
65
69
|
- test/dummy/config/database.yml
|
@@ -83,20 +87,14 @@ files:
|
|
83
87
|
- test/dummy/app/assets/stylesheets/application.css
|
84
88
|
- test/dummy/app/helpers/application_helper.rb
|
85
89
|
- test/dummy/app/controllers/application_controller.rb
|
86
|
-
- test/dummy/db/schema.rb
|
87
|
-
- test/dummy/db/development.sqlite3
|
88
90
|
- test/dummy/public/404.html
|
89
91
|
- test/dummy/public/422.html
|
90
92
|
- test/dummy/public/500.html
|
91
93
|
- test/dummy/public/favicon.ico
|
92
94
|
- test/test_helper.rb
|
93
95
|
- test/integration/navigation_test.rb
|
94
|
-
- test/
|
95
|
-
|
96
|
-
- test/book_test.rb
|
97
|
-
- test/functional/book/books_controller_test.rb
|
98
|
-
- test/fixtures/book/books.yml
|
99
|
-
homepage: http://mystory.cc/
|
96
|
+
- test/books_test.rb
|
97
|
+
homepage: http://zhangjian.mystory.cc/
|
100
98
|
licenses: []
|
101
99
|
post_install_message:
|
102
100
|
rdoc_options: []
|
@@ -119,10 +117,9 @@ rubyforge_project:
|
|
119
117
|
rubygems_version: 1.8.24
|
120
118
|
signing_key:
|
121
119
|
specification_version: 3
|
122
|
-
summary: Read and upload e-books
|
120
|
+
summary: Read and upload e-books. Distributed as Rails mountable engine
|
123
121
|
test_files:
|
124
122
|
- test/dummy/config.ru
|
125
|
-
- test/dummy/log/development.log
|
126
123
|
- test/dummy/config/boot.rb
|
127
124
|
- test/dummy/config/application.rb
|
128
125
|
- test/dummy/config/database.yml
|
@@ -146,16 +143,10 @@ test_files:
|
|
146
143
|
- test/dummy/app/assets/stylesheets/application.css
|
147
144
|
- test/dummy/app/helpers/application_helper.rb
|
148
145
|
- test/dummy/app/controllers/application_controller.rb
|
149
|
-
- test/dummy/db/schema.rb
|
150
|
-
- test/dummy/db/development.sqlite3
|
151
146
|
- test/dummy/public/404.html
|
152
147
|
- test/dummy/public/422.html
|
153
148
|
- test/dummy/public/500.html
|
154
149
|
- test/dummy/public/favicon.ico
|
155
150
|
- test/test_helper.rb
|
156
151
|
- test/integration/navigation_test.rb
|
157
|
-
- test/
|
158
|
-
- test/unit/book/book_test.rb
|
159
|
-
- test/book_test.rb
|
160
|
-
- test/functional/book/books_controller_test.rb
|
161
|
-
- test/fixtures/book/books.yml
|
152
|
+
- test/books_test.rb
|
@@ -1,56 +0,0 @@
|
|
1
|
-
body { background-color: #fff; color: #333; }
|
2
|
-
|
3
|
-
body, p, ol, ul, td {
|
4
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
-
font-size: 13px;
|
6
|
-
line-height: 18px;
|
7
|
-
}
|
8
|
-
|
9
|
-
pre {
|
10
|
-
background-color: #eee;
|
11
|
-
padding: 10px;
|
12
|
-
font-size: 11px;
|
13
|
-
}
|
14
|
-
|
15
|
-
a { color: #000; }
|
16
|
-
a:visited { color: #666; }
|
17
|
-
a:hover { color: #fff; background-color:#000; }
|
18
|
-
|
19
|
-
div.field, div.actions {
|
20
|
-
margin-bottom: 10px;
|
21
|
-
}
|
22
|
-
|
23
|
-
#notice {
|
24
|
-
color: green;
|
25
|
-
}
|
26
|
-
|
27
|
-
.field_with_errors {
|
28
|
-
padding: 2px;
|
29
|
-
background-color: red;
|
30
|
-
display: table;
|
31
|
-
}
|
32
|
-
|
33
|
-
#error_explanation {
|
34
|
-
width: 450px;
|
35
|
-
border: 2px solid red;
|
36
|
-
padding: 7px;
|
37
|
-
padding-bottom: 0;
|
38
|
-
margin-bottom: 20px;
|
39
|
-
background-color: #f0f0f0;
|
40
|
-
}
|
41
|
-
|
42
|
-
#error_explanation h2 {
|
43
|
-
text-align: left;
|
44
|
-
font-weight: bold;
|
45
|
-
padding: 5px 5px 5px 15px;
|
46
|
-
font-size: 12px;
|
47
|
-
margin: -7px;
|
48
|
-
margin-bottom: 0px;
|
49
|
-
background-color: #c00;
|
50
|
-
color: #fff;
|
51
|
-
}
|
52
|
-
|
53
|
-
#error_explanation ul li {
|
54
|
-
font-size: 12px;
|
55
|
-
list-style: square;
|
56
|
-
}
|
@@ -1,87 +0,0 @@
|
|
1
|
-
require_dependency "book/application_controller"
|
2
|
-
|
3
|
-
module Book
|
4
|
-
class BooksController < ApplicationController
|
5
|
-
# GET /books
|
6
|
-
# GET /books.json
|
7
|
-
def index
|
8
|
-
@books = Book.all
|
9
|
-
|
10
|
-
respond_to do |format|
|
11
|
-
format.html # index.html.erb
|
12
|
-
format.json { render json: @books }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# GET /books/1
|
17
|
-
# GET /books/1.json
|
18
|
-
def show
|
19
|
-
@book = Book.find(params[:id])
|
20
|
-
|
21
|
-
respond_to do |format|
|
22
|
-
format.html # show.html.erb
|
23
|
-
format.json { render json: @book }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# GET /books/new
|
28
|
-
# GET /books/new.json
|
29
|
-
def new
|
30
|
-
@book = Book.new
|
31
|
-
|
32
|
-
respond_to do |format|
|
33
|
-
format.html # new.html.erb
|
34
|
-
format.json { render json: @book }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# GET /books/1/edit
|
39
|
-
def edit
|
40
|
-
@book = Book.find(params[:id])
|
41
|
-
end
|
42
|
-
|
43
|
-
# POST /books
|
44
|
-
# POST /books.json
|
45
|
-
def create
|
46
|
-
@book = Book.new(params[:book])
|
47
|
-
|
48
|
-
respond_to do |format|
|
49
|
-
if @book.save
|
50
|
-
format.html { redirect_to @book, notice: 'Book was successfully created.' }
|
51
|
-
format.json { render json: @book, status: :created, location: @book }
|
52
|
-
else
|
53
|
-
format.html { render action: "new" }
|
54
|
-
format.json { render json: @book.errors, status: :unprocessable_entity }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# PUT /books/1
|
60
|
-
# PUT /books/1.json
|
61
|
-
def update
|
62
|
-
@book = Book.find(params[:id])
|
63
|
-
|
64
|
-
respond_to do |format|
|
65
|
-
if @book.update_attributes(params[:book])
|
66
|
-
format.html { redirect_to @book, notice: 'Book was successfully updated.' }
|
67
|
-
format.json { head :no_content }
|
68
|
-
else
|
69
|
-
format.html { render action: "edit" }
|
70
|
-
format.json { render json: @book.errors, status: :unprocessable_entity }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# DELETE /books/1
|
76
|
-
# DELETE /books/1.json
|
77
|
-
def destroy
|
78
|
-
@book = Book.find(params[:id])
|
79
|
-
@book.destroy
|
80
|
-
|
81
|
-
respond_to do |format|
|
82
|
-
format.html { redirect_to books_url }
|
83
|
-
format.json { head :no_content }
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
data/app/models/book/book.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
<%= form_for(@book) do |f| %>
|
2
|
-
<% if @book.errors.any? %>
|
3
|
-
<div id="error_explanation">
|
4
|
-
<h2><%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:</h2>
|
5
|
-
|
6
|
-
<ul>
|
7
|
-
<% @book.errors.full_messages.each do |msg| %>
|
8
|
-
<li><%= msg %></li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<div class="field">
|
15
|
-
<%= f.label :title %><br />
|
16
|
-
<%= f.text_field :title %>
|
17
|
-
</div>
|
18
|
-
<div class="field">
|
19
|
-
<%= f.label :summary %><br />
|
20
|
-
<%= f.text_area :summary %>
|
21
|
-
</div>
|
22
|
-
<div class="field">
|
23
|
-
<%= f.label :body %><br />
|
24
|
-
<%= f.text_area :body %>
|
25
|
-
</div>
|
26
|
-
<div class="field">
|
27
|
-
<%= f.label :writer %><br />
|
28
|
-
<%= f.text_field :writer %>
|
29
|
-
</div>
|
30
|
-
<div class="actions">
|
31
|
-
<%= f.submit %>
|
32
|
-
</div>
|
33
|
-
<% end %>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<h1>Listing books</h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<th>Title</th>
|
6
|
-
<th>Summary</th>
|
7
|
-
<th>Body</th>
|
8
|
-
<th>Writer</th>
|
9
|
-
<th></th>
|
10
|
-
<th></th>
|
11
|
-
<th></th>
|
12
|
-
</tr>
|
13
|
-
|
14
|
-
<% @books.each do |book| %>
|
15
|
-
<tr>
|
16
|
-
<td><%= book.title %></td>
|
17
|
-
<td><%= book.summary %></td>
|
18
|
-
<td><%= book.body %></td>
|
19
|
-
<td><%= book.writer %></td>
|
20
|
-
<td><%= link_to 'Show', book %></td>
|
21
|
-
<td><%= link_to 'Edit', edit_book_path(book) %></td>
|
22
|
-
<td><%= link_to 'Destroy', book, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
23
|
-
</tr>
|
24
|
-
<% end %>
|
25
|
-
</table>
|
26
|
-
|
27
|
-
<br />
|
28
|
-
|
29
|
-
<%= link_to 'New Book', new_book_path %>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<p id="notice"><%= notice %></p>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<b>Title:</b>
|
5
|
-
<%= @book.title %>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<p>
|
9
|
-
<b>Summary:</b>
|
10
|
-
<%= @book.summary %>
|
11
|
-
</p>
|
12
|
-
|
13
|
-
<p>
|
14
|
-
<b>Body:</b>
|
15
|
-
<%= @book.body %>
|
16
|
-
</p>
|
17
|
-
|
18
|
-
<p>
|
19
|
-
<b>Writer:</b>
|
20
|
-
<%= @book.writer %>
|
21
|
-
</p>
|
22
|
-
|
23
|
-
|
24
|
-
<%= link_to 'Edit', edit_book_path(@book) %> |
|
25
|
-
<%= link_to 'Back', books_path %>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Book</title>
|
5
|
-
<%= stylesheet_link_tag "book/application", :media => "all" %>
|
6
|
-
<%= javascript_include_tag "book/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
data/lib/book.rb
DELETED
data/lib/book/version.rb
DELETED
data/test/book_test.rb
DELETED
Binary file
|
data/test/dummy/db/schema.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended to check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(:version => 20130126052634) do
|
15
|
-
|
16
|
-
create_table "book_books", :force => true do |t|
|
17
|
-
t.string "title"
|
18
|
-
t.text "summary"
|
19
|
-
t.text "body"
|
20
|
-
t.string "writer"
|
21
|
-
t.datetime "created_at", :null => false
|
22
|
-
t.datetime "updated_at", :null => false
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Connecting to database specified by database.yml
|
2
|
-
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
3
|
-
[1m[35m (116.9ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
4
|
-
[1m[36m (65.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
5
|
-
[1m[35m (1.9ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
6
|
-
Migrating to CreateBookBooks (20130126052634)
|
7
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
8
|
-
[1m[35m (0.4ms)[0m CREATE TABLE "book_books" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "summary" text, "body" text, "writer" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
9
|
-
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20130126052634')[0m
|
10
|
-
[1m[35m (121.0ms)[0m commit transaction
|
11
|
-
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Book
|
4
|
-
class BooksControllerTest < ActionController::TestCase
|
5
|
-
setup do
|
6
|
-
@book = books(:one)
|
7
|
-
end
|
8
|
-
|
9
|
-
test "should get index" do
|
10
|
-
get :index
|
11
|
-
assert_response :success
|
12
|
-
assert_not_nil assigns(:books)
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should get new" do
|
16
|
-
get :new
|
17
|
-
assert_response :success
|
18
|
-
end
|
19
|
-
|
20
|
-
test "should create book" do
|
21
|
-
assert_difference('Book.count') do
|
22
|
-
post :create, book: { body: @book.body, summary: @book.summary, title: @book.title, writer: @book.writer }
|
23
|
-
end
|
24
|
-
|
25
|
-
assert_redirected_to book_path(assigns(:book))
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should show book" do
|
29
|
-
get :show, id: @book
|
30
|
-
assert_response :success
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should get edit" do
|
34
|
-
get :edit, id: @book
|
35
|
-
assert_response :success
|
36
|
-
end
|
37
|
-
|
38
|
-
test "should update book" do
|
39
|
-
put :update, id: @book, book: { body: @book.body, summary: @book.summary, title: @book.title, writer: @book.writer }
|
40
|
-
assert_redirected_to book_path(assigns(:book))
|
41
|
-
end
|
42
|
-
|
43
|
-
test "should destroy book" do
|
44
|
-
assert_difference('Book.count', -1) do
|
45
|
-
delete :destroy, id: @book
|
46
|
-
end
|
47
|
-
|
48
|
-
assert_redirected_to books_path
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/test/unit/book/book_test.rb
DELETED