enju_bookmark 0.1.2.pre15 → 0.1.2.pre16
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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/enju_bookmark/acts_as_taggable_stylesheet.css +7 -0
- data/app/controllers/bookmarks_controller.rb +8 -14
- data/app/models/bookmark.rb +13 -21
- data/app/views/bookmarks/show.html.erb +5 -0
- data/lib/enju_bookmark/manifestation.rb +3 -7
- data/lib/enju_bookmark/version.rb +1 -1
- data/spec/controllers/bookmark_stats_controller_spec.rb +49 -49
- data/spec/controllers/bookmarks_controller_spec.rb +76 -76
- data/spec/controllers/tags_controller_spec.rb +28 -28
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_1i0 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001933 +0 -0
- data/spec/dummy/solr/default/data/tlog/{tlog.0000000000000001700 → tlog.0000000000000001934} +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001935 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001936 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001937 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001938 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001939 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001940 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001941 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001942 +0 -0
- data/spec/fixtures/languages.yml +1 -1
- data/spec/spec_helper.rb +3 -0
- metadata +43 -35
- data/app/views/bookmark_stat_has_manifestations/_form.html.erb +0 -15
- data/app/views/bookmark_stat_has_manifestations/edit.html.erb +0 -13
- data/app/views/bookmark_stat_has_manifestations/index.html.erb +0 -32
- data/app/views/bookmark_stat_has_manifestations/new.html.erb +0 -12
- data/app/views/bookmark_stat_has_manifestations/show.html.erb +0 -29
- data/spec/controllers/bookmark_stat_has_manifestations_controller_spec.rb +0 -443
- data/spec/dummy/solr/default/data/index/segments_1bi +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001699 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001701 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001702 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001703 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001704 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001705 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001706 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001707 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001708 +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3b6a46ac63019863a0eb3a558985ed23f474868
|
|
4
|
+
data.tar.gz: ecc44cd3999d5f1ca634ff8e68086490bf5d88d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d2c7241afa3ca132d3206dc3e618ca723e208109805d9b8fefe9763703ccc1b48d7e3b9d281b1829452f8b5e78fb398cadbe3c5e0cc21923f1c015a033eca62
|
|
7
|
+
data.tar.gz: 297f8f3d0b0cf22c26c19be85581004858fea1077b4e6c98b99dd7406feab1d7958bb5f3d5b49ad642edfe86d08b2a3649015a49e503ccc3911eabd26d3ed854
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
.hTagcloud .popularity { margin:0; padding:0; }
|
|
2
|
+
.hTagcloud .popularity li { display:inline; text-decoration:none; line-height: 2em; }
|
|
3
|
+
.hTagcloud .popularity .popular { font-size:1.0em; }
|
|
4
|
+
.hTagcloud .popularity .v-popular { font-size:1.2em; }
|
|
5
|
+
.hTagcloud .popularity .vv-popular { font-size:1.4em; }
|
|
6
|
+
.hTagcloud .popularity .vvv-popular { font-size:1.6em; }
|
|
7
|
+
.hTagcloud .popularity .vvvv-popular { font-size:1.8em; }
|
|
@@ -81,14 +81,12 @@ class BookmarksController < ApplicationController
|
|
|
81
81
|
|
|
82
82
|
respond_to do |format|
|
|
83
83
|
if @bookmark.save
|
|
84
|
-
|
|
85
|
-
@bookmark.create_tag_index
|
|
86
|
-
@bookmark.manifestation.index!
|
|
84
|
+
@bookmark.tag_index!
|
|
87
85
|
if params[:mode] == 'tag_edit'
|
|
88
|
-
format.html { redirect_to
|
|
86
|
+
format.html { redirect_to @bookmark.manifestation , notice: t('controller.successfully_created', model: t('activerecord.models.bookmark')) }
|
|
89
87
|
format.json { render json: @bookmark, status: :created, location: @bookmark }
|
|
90
88
|
else
|
|
91
|
-
format.html { redirect_to
|
|
89
|
+
format.html { redirect_to @bookmark , notice: t('controller.successfully_created', model: t('activerecord.models.bookmark')) }
|
|
92
90
|
format.json { render json: @bookmark, status: :created, location: @bookmark }
|
|
93
91
|
end
|
|
94
92
|
else
|
|
@@ -112,15 +110,13 @@ class BookmarksController < ApplicationController
|
|
|
112
110
|
|
|
113
111
|
respond_to do |format|
|
|
114
112
|
if @bookmark.update_attributes(params[:bookmark])
|
|
115
|
-
|
|
116
|
-
@bookmark.manifestation.index!
|
|
117
|
-
@bookmark.create_tag_index
|
|
113
|
+
@bookmark.tag_index!
|
|
118
114
|
case params[:mode]
|
|
119
115
|
when 'tag_edit'
|
|
120
|
-
format.html { redirect_to @bookmark.manifestation }
|
|
116
|
+
format.html { redirect_to @bookmark.manifestation, notice: t('controller.successfully_updated', model: t('activerecord.models.bookmark')) }
|
|
121
117
|
format.json { head :no_content }
|
|
122
118
|
else
|
|
123
|
-
format.html { redirect_to @bookmark }
|
|
119
|
+
format.html { redirect_to @bookmark, notice: t('controller.successfully_updated', model: t('activerecord.models.bookmark')) }
|
|
124
120
|
format.json { head :no_content }
|
|
125
121
|
end
|
|
126
122
|
else
|
|
@@ -134,17 +130,15 @@ class BookmarksController < ApplicationController
|
|
|
134
130
|
# DELETE /bookmarks/1.json
|
|
135
131
|
def destroy
|
|
136
132
|
@bookmark.destroy
|
|
137
|
-
flash[:notice] = t('controller.successfully_deleted', model: t('activerecord.models.bookmark'))
|
|
138
|
-
@bookmark.create_tag_index
|
|
139
133
|
|
|
140
134
|
if @user
|
|
141
135
|
respond_to do |format|
|
|
142
|
-
format.html { redirect_to bookmarks_url(user_id: @user.username) }
|
|
136
|
+
format.html { redirect_to bookmarks_url(user_id: @user.username), notice: t('controller.successfully_deleted', model: t('activerecord.models.bookmark')) }
|
|
143
137
|
format.json { head :no_content }
|
|
144
138
|
end
|
|
145
139
|
else
|
|
146
140
|
respond_to do |format|
|
|
147
|
-
format.html { redirect_to bookmarks_url(user_id: @bookmark.user.username) }
|
|
141
|
+
format.html { redirect_to bookmarks_url(user_id: @bookmark.user.username), notice: t('controller.successfully_deleted', model: t('activerecord.models.bookmark')) }
|
|
148
142
|
format.json { head :no_content }
|
|
149
143
|
end
|
|
150
144
|
end
|
data/app/models/bookmark.rb
CHANGED
|
@@ -13,11 +13,10 @@ class Bookmark < ActiveRecord::Base
|
|
|
13
13
|
validates_associated :user, :manifestation
|
|
14
14
|
validates_uniqueness_of :manifestation_id, scope: :user_id
|
|
15
15
|
validates :url, url: true, presence: true, length: {:maximum => 255}
|
|
16
|
-
before_save :create_manifestation, :if => :url_changed?
|
|
17
16
|
validate :bookmarkable_url?
|
|
18
17
|
validate :already_bookmarked?, :if => :url_changed?
|
|
18
|
+
before_save :create_manifestation, :if => :url_changed?
|
|
19
19
|
before_save :replace_space_in_tags
|
|
20
|
-
after_destroy :reindex_manifestation
|
|
21
20
|
|
|
22
21
|
acts_as_taggable_on :tags
|
|
23
22
|
normalize_attributes :url
|
|
@@ -28,7 +27,7 @@ class Bookmark < ActiveRecord::Base
|
|
|
28
27
|
end
|
|
29
28
|
string :url
|
|
30
29
|
string :tag, multiple: true do
|
|
31
|
-
|
|
30
|
+
tag_list
|
|
32
31
|
end
|
|
33
32
|
integer :user_id
|
|
34
33
|
integer :manifestation_id
|
|
@@ -41,15 +40,10 @@ class Bookmark < ActiveRecord::Base
|
|
|
41
40
|
|
|
42
41
|
def replace_space_in_tags
|
|
43
42
|
# タグに含まれている全角スペースを除去する
|
|
44
|
-
self.tag_list =
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def reindex_manifestation
|
|
48
|
-
self.manifestation.try(:index!)
|
|
43
|
+
self.tag_list = tag_list.map{|tag| tag.gsub(' ', ' ').gsub(' ', ', ')}
|
|
49
44
|
end
|
|
50
45
|
|
|
51
46
|
def save_tagger
|
|
52
|
-
#user.tag(self, with: tag_list, on: :tags)
|
|
53
47
|
taggings.each do |tagging|
|
|
54
48
|
tagging.tagger = user
|
|
55
49
|
tagging.save(validate: false)
|
|
@@ -57,7 +51,7 @@ class Bookmark < ActiveRecord::Base
|
|
|
57
51
|
end
|
|
58
52
|
|
|
59
53
|
def shelved?
|
|
60
|
-
true if
|
|
54
|
+
true if manifestation.items.on_web.first
|
|
61
55
|
end
|
|
62
56
|
|
|
63
57
|
def self.get_title(string)
|
|
@@ -132,7 +126,7 @@ class Bookmark < ActiveRecord::Base
|
|
|
132
126
|
if url.try(:my_host?)
|
|
133
127
|
manifestation = self.my_host_resource
|
|
134
128
|
else
|
|
135
|
-
manifestation = Manifestation.where(:access_address =>
|
|
129
|
+
manifestation = Manifestation.where(:access_address => url).first if url.present?
|
|
136
130
|
end
|
|
137
131
|
end
|
|
138
132
|
|
|
@@ -152,17 +146,15 @@ class Bookmark < ActiveRecord::Base
|
|
|
152
146
|
end
|
|
153
147
|
manifestation = Manifestation.new(:access_address => url)
|
|
154
148
|
manifestation.carrier_type = CarrierType.where(name: 'file').first
|
|
155
|
-
if
|
|
156
|
-
manifestation.original_title =
|
|
149
|
+
if title.present?
|
|
150
|
+
manifestation.original_title = title
|
|
157
151
|
else
|
|
158
152
|
manifestation.original_title = self.get_title
|
|
159
153
|
end
|
|
160
154
|
Manifestation.transaction do
|
|
161
155
|
manifestation.save
|
|
162
156
|
self.manifestation = manifestation
|
|
163
|
-
item = Item.new
|
|
164
|
-
:manifestation_id => manifestation.id
|
|
165
|
-
)
|
|
157
|
+
item = Item.new
|
|
166
158
|
item.shelf = Shelf.web
|
|
167
159
|
item.manifestation = manifestation
|
|
168
160
|
if defined?(EnjuCirculation)
|
|
@@ -184,12 +176,12 @@ class Bookmark < ActiveRecord::Base
|
|
|
184
176
|
end
|
|
185
177
|
end
|
|
186
178
|
|
|
187
|
-
def
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
179
|
+
def tag_index!
|
|
180
|
+
manifestation.reload
|
|
181
|
+
manifestation.index
|
|
182
|
+
taggings.map{|tagging| Tag.find(tagging.tag_id).index}
|
|
183
|
+
Sunspot.commit
|
|
191
184
|
end
|
|
192
|
-
|
|
193
185
|
end
|
|
194
186
|
|
|
195
187
|
# == Schema Information
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
<%- } -%>
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
|
+
<p>
|
|
29
|
+
<strong><%= t('activerecord.attributes.bookmark.shared') -%>:</strong>
|
|
30
|
+
<%= localized_boolean(@bookmark.shared) -%>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
28
33
|
<p>
|
|
29
34
|
<strong><%= t('activerecord.attributes.bookmark.note') -%>:</strong>
|
|
30
35
|
<%= @bookmark.note -%>
|
|
@@ -12,10 +12,10 @@ module EnjuBookmark
|
|
|
12
12
|
|
|
13
13
|
searchable do
|
|
14
14
|
string :tag, :multiple => true do
|
|
15
|
-
|
|
15
|
+
bookmarks.map{|bookmark| bookmark.tag_list}.flatten
|
|
16
16
|
end
|
|
17
17
|
text :tag do
|
|
18
|
-
|
|
18
|
+
bookmarks.map{|bookmark| bookmark.tag_list}.flatten
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -28,11 +28,7 @@ module EnjuBookmark
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def tags
|
|
31
|
-
|
|
32
|
-
self.bookmarks.tag_counts
|
|
33
|
-
else
|
|
34
|
-
[]
|
|
35
|
-
end
|
|
31
|
+
bookmarks.map{|bookmark| bookmark.tags}.flatten
|
|
36
32
|
end
|
|
37
33
|
end
|
|
38
34
|
end
|
|
@@ -15,7 +15,7 @@ describe BookmarkStatsController do
|
|
|
15
15
|
|
|
16
16
|
it "assigns all bookmark_stats as @bookmark_stats" do
|
|
17
17
|
get :index
|
|
18
|
-
assigns(:bookmark_stats).
|
|
18
|
+
expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -24,7 +24,7 @@ describe BookmarkStatsController do
|
|
|
24
24
|
|
|
25
25
|
it "assigns all bookmark_stats as @bookmark_stats" do
|
|
26
26
|
get :index
|
|
27
|
-
assigns(:bookmark_stats).
|
|
27
|
+
expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -33,14 +33,14 @@ describe BookmarkStatsController do
|
|
|
33
33
|
|
|
34
34
|
it "assigns all bookmark_stats as @bookmark_stats" do
|
|
35
35
|
get :index
|
|
36
|
-
assigns(:bookmark_stats).
|
|
36
|
+
expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
describe "When not logged in" do
|
|
41
41
|
it "should not assign bookmark_stats as @bookmark_stats" do
|
|
42
42
|
get :index
|
|
43
|
-
assigns(:bookmark_stats).
|
|
43
|
+
expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -52,7 +52,7 @@ describe BookmarkStatsController do
|
|
|
52
52
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
53
53
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
54
54
|
get :show, :id => bookmark_stat.id
|
|
55
|
-
assigns(:bookmark_stat).
|
|
55
|
+
expect(assigns(:bookmark_stat)).to eq(bookmark_stat)
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -62,7 +62,7 @@ describe BookmarkStatsController do
|
|
|
62
62
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
63
63
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
64
64
|
get :show, :id => bookmark_stat.id
|
|
65
|
-
assigns(:bookmark_stat).
|
|
65
|
+
expect(assigns(:bookmark_stat)).to eq(bookmark_stat)
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -72,7 +72,7 @@ describe BookmarkStatsController do
|
|
|
72
72
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
73
73
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
74
74
|
get :show, :id => bookmark_stat.id
|
|
75
|
-
assigns(:bookmark_stat).
|
|
75
|
+
expect(assigns(:bookmark_stat)).to eq(bookmark_stat)
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
@@ -80,7 +80,7 @@ describe BookmarkStatsController do
|
|
|
80
80
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
81
81
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
82
82
|
get :show, :id => bookmark_stat.id
|
|
83
|
-
assigns(:bookmark_stat).
|
|
83
|
+
expect(assigns(:bookmark_stat)).to eq(bookmark_stat)
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
end
|
|
@@ -91,7 +91,7 @@ describe BookmarkStatsController do
|
|
|
91
91
|
|
|
92
92
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
93
93
|
get :new
|
|
94
|
-
assigns(:bookmark_stat).
|
|
94
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -100,7 +100,7 @@ describe BookmarkStatsController do
|
|
|
100
100
|
|
|
101
101
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
102
102
|
get :new
|
|
103
|
-
assigns(:bookmark_stat).
|
|
103
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -109,16 +109,16 @@ describe BookmarkStatsController do
|
|
|
109
109
|
|
|
110
110
|
it "should not assign the requested bookmark_stat as @bookmark_stat" do
|
|
111
111
|
get :new
|
|
112
|
-
assigns(:bookmark_stat).
|
|
113
|
-
response.
|
|
112
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
113
|
+
expect(response).to be_forbidden
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
describe "When not logged in" do
|
|
118
118
|
it "should not assign the requested bookmark_stat as @bookmark_stat" do
|
|
119
119
|
get :new
|
|
120
|
-
assigns(:bookmark_stat).
|
|
121
|
-
response.
|
|
120
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
121
|
+
expect(response).to redirect_to(new_user_session_url)
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
124
|
end
|
|
@@ -130,7 +130,7 @@ describe BookmarkStatsController do
|
|
|
130
130
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
131
131
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
132
132
|
get :edit, :id => bookmark_stat.id
|
|
133
|
-
assigns(:bookmark_stat).
|
|
133
|
+
expect(assigns(:bookmark_stat)).to eq(bookmark_stat)
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
|
|
@@ -140,7 +140,7 @@ describe BookmarkStatsController do
|
|
|
140
140
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
141
141
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
142
142
|
get :edit, :id => bookmark_stat.id
|
|
143
|
-
assigns(:bookmark_stat).
|
|
143
|
+
expect(assigns(:bookmark_stat)).to eq(bookmark_stat)
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
|
@@ -150,7 +150,7 @@ describe BookmarkStatsController do
|
|
|
150
150
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
151
151
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
152
152
|
get :edit, :id => bookmark_stat.id
|
|
153
|
-
response.
|
|
153
|
+
expect(response).to be_forbidden
|
|
154
154
|
end
|
|
155
155
|
end
|
|
156
156
|
|
|
@@ -158,7 +158,7 @@ describe BookmarkStatsController do
|
|
|
158
158
|
it "should not assign the requested bookmark_stat as @bookmark_stat" do
|
|
159
159
|
bookmark_stat = FactoryGirl.create(:bookmark_stat)
|
|
160
160
|
get :edit, :id => bookmark_stat.id
|
|
161
|
-
response.
|
|
161
|
+
expect(response).to redirect_to(new_user_session_url)
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
end
|
|
@@ -175,24 +175,24 @@ describe BookmarkStatsController do
|
|
|
175
175
|
describe "with valid params" do
|
|
176
176
|
it "assigns a newly created bookmark_stat as @bookmark_stat" do
|
|
177
177
|
post :create, :bookmark_stat => @attrs
|
|
178
|
-
assigns(:bookmark_stat).
|
|
178
|
+
expect(assigns(:bookmark_stat)).to be_valid
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
it "redirects to the created bookmark_stat" do
|
|
182
182
|
post :create, :bookmark_stat => @attrs
|
|
183
|
-
response.
|
|
183
|
+
expect(response).to redirect_to(bookmark_stat_url(assigns(:bookmark_stat)))
|
|
184
184
|
end
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
describe "with invalid params" do
|
|
188
188
|
it "assigns a newly created but unsaved bookmark_stat as @bookmark_stat" do
|
|
189
189
|
post :create, :bookmark_stat => @invalid_attrs
|
|
190
|
-
assigns(:bookmark_stat).
|
|
190
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
it "re-renders the 'new' template" do
|
|
194
194
|
post :create, :bookmark_stat => @invalid_attrs
|
|
195
|
-
response.
|
|
195
|
+
expect(response).to render_template("new")
|
|
196
196
|
end
|
|
197
197
|
end
|
|
198
198
|
end
|
|
@@ -203,24 +203,24 @@ describe BookmarkStatsController do
|
|
|
203
203
|
describe "with valid params" do
|
|
204
204
|
it "assigns a newly created bookmark_stat as @bookmark_stat" do
|
|
205
205
|
post :create, :bookmark_stat => @attrs
|
|
206
|
-
assigns(:bookmark_stat).
|
|
206
|
+
expect(assigns(:bookmark_stat)).to be_valid
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
it "redirects to the created bookmark_stat" do
|
|
210
210
|
post :create, :bookmark_stat => @attrs
|
|
211
|
-
response.
|
|
211
|
+
expect(response).to redirect_to(bookmark_stat_url(assigns(:bookmark_stat)))
|
|
212
212
|
end
|
|
213
213
|
end
|
|
214
214
|
|
|
215
215
|
describe "with invalid params" do
|
|
216
216
|
it "assigns a newly created but unsaved bookmark_stat as @bookmark_stat" do
|
|
217
217
|
post :create, :bookmark_stat => @invalid_attrs
|
|
218
|
-
assigns(:bookmark_stat).
|
|
218
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
219
219
|
end
|
|
220
220
|
|
|
221
221
|
it "re-renders the 'new' template" do
|
|
222
222
|
post :create, :bookmark_stat => @invalid_attrs
|
|
223
|
-
response.
|
|
223
|
+
expect(response).to render_template("new")
|
|
224
224
|
end
|
|
225
225
|
end
|
|
226
226
|
end
|
|
@@ -231,24 +231,24 @@ describe BookmarkStatsController do
|
|
|
231
231
|
describe "with valid params" do
|
|
232
232
|
it "assigns a newly created bookmark_stat as @bookmark_stat" do
|
|
233
233
|
post :create, :bookmark_stat => @attrs
|
|
234
|
-
assigns(:bookmark_stat).
|
|
234
|
+
expect(assigns(:bookmark_stat)).to be_valid
|
|
235
235
|
end
|
|
236
236
|
|
|
237
237
|
it "should be forbidden" do
|
|
238
238
|
post :create, :bookmark_stat => @attrs
|
|
239
|
-
response.
|
|
239
|
+
expect(response).to be_forbidden
|
|
240
240
|
end
|
|
241
241
|
end
|
|
242
242
|
|
|
243
243
|
describe "with invalid params" do
|
|
244
244
|
it "assigns a newly created but unsaved bookmark_stat as @bookmark_stat" do
|
|
245
245
|
post :create, :bookmark_stat => @invalid_attrs
|
|
246
|
-
assigns(:bookmark_stat).
|
|
246
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
247
247
|
end
|
|
248
248
|
|
|
249
249
|
it "should be forbidden" do
|
|
250
250
|
post :create, :bookmark_stat => @invalid_attrs
|
|
251
|
-
response.
|
|
251
|
+
expect(response).to be_forbidden
|
|
252
252
|
end
|
|
253
253
|
end
|
|
254
254
|
end
|
|
@@ -257,24 +257,24 @@ describe BookmarkStatsController do
|
|
|
257
257
|
describe "with valid params" do
|
|
258
258
|
it "assigns a newly created bookmark_stat as @bookmark_stat" do
|
|
259
259
|
post :create, :bookmark_stat => @attrs
|
|
260
|
-
assigns(:bookmark_stat).
|
|
260
|
+
expect(assigns(:bookmark_stat)).to be_valid
|
|
261
261
|
end
|
|
262
262
|
|
|
263
263
|
it "should be forbidden" do
|
|
264
264
|
post :create, :bookmark_stat => @attrs
|
|
265
|
-
response.
|
|
265
|
+
expect(response).to redirect_to(new_user_session_url)
|
|
266
266
|
end
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
describe "with invalid params" do
|
|
270
270
|
it "assigns a newly created but unsaved bookmark_stat as @bookmark_stat" do
|
|
271
271
|
post :create, :bookmark_stat => @invalid_attrs
|
|
272
|
-
assigns(:bookmark_stat).
|
|
272
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
273
273
|
end
|
|
274
274
|
|
|
275
275
|
it "should be forbidden" do
|
|
276
276
|
post :create, :bookmark_stat => @invalid_attrs
|
|
277
|
-
response.
|
|
277
|
+
expect(response).to redirect_to(new_user_session_url)
|
|
278
278
|
end
|
|
279
279
|
end
|
|
280
280
|
end
|
|
@@ -297,14 +297,14 @@ describe BookmarkStatsController do
|
|
|
297
297
|
|
|
298
298
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
299
299
|
put :update, :id => @bookmark_stat.id, :bookmark_stat => @attrs
|
|
300
|
-
assigns(:bookmark_stat).
|
|
300
|
+
expect(assigns(:bookmark_stat)).to eq(@bookmark_stat)
|
|
301
301
|
end
|
|
302
302
|
end
|
|
303
303
|
|
|
304
304
|
describe "with invalid params" do
|
|
305
305
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
306
306
|
put :update, :id => @bookmark_stat.id, :bookmark_stat => @invalid_attrs
|
|
307
|
-
response.
|
|
307
|
+
expect(response).to render_template("edit")
|
|
308
308
|
end
|
|
309
309
|
end
|
|
310
310
|
end
|
|
@@ -319,20 +319,20 @@ describe BookmarkStatsController do
|
|
|
319
319
|
|
|
320
320
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
321
321
|
put :update, :id => @bookmark_stat.id, :bookmark_stat => @attrs
|
|
322
|
-
assigns(:bookmark_stat).
|
|
323
|
-
response.
|
|
322
|
+
expect(assigns(:bookmark_stat)).to eq(@bookmark_stat)
|
|
323
|
+
expect(response).to redirect_to(@bookmark_stat)
|
|
324
324
|
end
|
|
325
325
|
end
|
|
326
326
|
|
|
327
327
|
describe "with invalid params" do
|
|
328
328
|
it "assigns the bookmark_stat as @bookmark_stat" do
|
|
329
329
|
put :update, :id => @bookmark_stat, :bookmark_stat => @invalid_attrs
|
|
330
|
-
assigns(:bookmark_stat).
|
|
330
|
+
expect(assigns(:bookmark_stat)).not_to be_valid
|
|
331
331
|
end
|
|
332
332
|
|
|
333
333
|
it "re-renders the 'edit' template" do
|
|
334
334
|
put :update, :id => @bookmark_stat, :bookmark_stat => @invalid_attrs
|
|
335
|
-
response.
|
|
335
|
+
expect(response).to render_template("edit")
|
|
336
336
|
end
|
|
337
337
|
end
|
|
338
338
|
end
|
|
@@ -347,15 +347,15 @@ describe BookmarkStatsController do
|
|
|
347
347
|
|
|
348
348
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
349
349
|
put :update, :id => @bookmark_stat.id, :bookmark_stat => @attrs
|
|
350
|
-
assigns(:bookmark_stat).
|
|
351
|
-
response.
|
|
350
|
+
expect(assigns(:bookmark_stat)).to eq(@bookmark_stat)
|
|
351
|
+
expect(response).to be_forbidden
|
|
352
352
|
end
|
|
353
353
|
end
|
|
354
354
|
|
|
355
355
|
describe "with invalid params" do
|
|
356
356
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
357
357
|
put :update, :id => @bookmark_stat.id, :bookmark_stat => @invalid_attrs
|
|
358
|
-
response.
|
|
358
|
+
expect(response).to be_forbidden
|
|
359
359
|
end
|
|
360
360
|
end
|
|
361
361
|
end
|
|
@@ -368,14 +368,14 @@ describe BookmarkStatsController do
|
|
|
368
368
|
|
|
369
369
|
it "should be forbidden" do
|
|
370
370
|
put :update, :id => @bookmark_stat.id, :bookmark_stat => @attrs
|
|
371
|
-
response.
|
|
371
|
+
expect(response).to redirect_to(new_user_session_url)
|
|
372
372
|
end
|
|
373
373
|
end
|
|
374
374
|
|
|
375
375
|
describe "with invalid params" do
|
|
376
376
|
it "assigns the requested bookmark_stat as @bookmark_stat" do
|
|
377
377
|
put :update, :id => @bookmark_stat.id, :bookmark_stat => @invalid_attrs
|
|
378
|
-
response.
|
|
378
|
+
expect(response).to redirect_to(new_user_session_url)
|
|
379
379
|
end
|
|
380
380
|
end
|
|
381
381
|
end
|
|
@@ -395,7 +395,7 @@ describe BookmarkStatsController do
|
|
|
395
395
|
|
|
396
396
|
it "redirects to the bookmark_stats list" do
|
|
397
397
|
delete :destroy, :id => @bookmark_stat.id
|
|
398
|
-
response.
|
|
398
|
+
expect(response).to redirect_to(bookmark_stats_url)
|
|
399
399
|
end
|
|
400
400
|
end
|
|
401
401
|
|
|
@@ -408,7 +408,7 @@ describe BookmarkStatsController do
|
|
|
408
408
|
|
|
409
409
|
it "should be forbidden" do
|
|
410
410
|
delete :destroy, :id => @bookmark_stat.id
|
|
411
|
-
response.
|
|
411
|
+
expect(response).to be_forbidden
|
|
412
412
|
end
|
|
413
413
|
end
|
|
414
414
|
|
|
@@ -421,7 +421,7 @@ describe BookmarkStatsController do
|
|
|
421
421
|
|
|
422
422
|
it "should be forbidden" do
|
|
423
423
|
delete :destroy, :id => @bookmark_stat.id
|
|
424
|
-
response.
|
|
424
|
+
expect(response).to be_forbidden
|
|
425
425
|
end
|
|
426
426
|
end
|
|
427
427
|
|
|
@@ -432,7 +432,7 @@ describe BookmarkStatsController do
|
|
|
432
432
|
|
|
433
433
|
it "should be forbidden" do
|
|
434
434
|
delete :destroy, :id => @bookmark_stat.id
|
|
435
|
-
response.
|
|
435
|
+
expect(response).to redirect_to(new_user_session_url)
|
|
436
436
|
end
|
|
437
437
|
end
|
|
438
438
|
end
|