days 0.2.0 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +21 -4
- data/app/javascripts/admin/bootstrap.min.js +7 -0
- data/app/javascripts/jquery-2.1.3.min.js +4 -0
- data/app/stylesheets/admin/bootstrap-theme.min.css +5 -0
- data/app/stylesheets/admin/bootstrap.min.css +5 -0
- data/app/stylesheets/admin/login.scss +3 -5
- data/app/stylesheets/admin.scss +4 -0
- data/app/views/admin/categories.haml +3 -3
- data/app/views/admin/entries/form.haml +22 -17
- data/app/views/admin/entries/index.haml +46 -28
- data/app/views/admin/login.haml +11 -8
- data/app/views/admin/setup.haml +16 -9
- data/app/views/admin.haml +31 -21
- data/days.gemspec +14 -11
- data/lib/days/app/admin/entries.rb +11 -5
- data/lib/days/app/entries.rb +24 -13
- data/lib/days/app.rb +2 -3
- data/lib/days/command.rb +1 -1
- data/lib/days/config.rb +18 -5
- data/lib/days/helpers.rb +13 -11
- data/lib/days/models/base.rb +11 -0
- data/lib/days/models/category.rb +2 -2
- data/lib/days/models/entry.rb +41 -8
- data/lib/days/models/user.rb +2 -2
- data/lib/days/version.rb +1 -1
- data/scripts/tumblr_export.rb +1 -1
- data/spec/controllers/admin/categories_spec.rb +22 -22
- data/spec/controllers/admin/entries_spec.rb +155 -44
- data/spec/controllers/admin/session_spec.rb +16 -25
- data/spec/controllers/admin/setup_spec.rb +22 -25
- data/spec/controllers/admin/users_spec.rb +39 -40
- data/spec/controllers/entries_spec.rb +71 -42
- data/spec/helpers_spec.rb +18 -29
- data/spec/models/entry_spec.rb +117 -47
- data/spec/shared/admin.rb +2 -2
- data/spec/spec_helper.rb +25 -25
- metadata +111 -86
- data/app/javascripts/bootstrap.js +0 -2159
- data/app/javascripts/bootstrap.min.js +0 -6
- data/app/javascripts/jquery-1.8.3.min.js +0 -2
- data/app/stylesheets/bootstrap-responsive.css +0 -1092
- data/app/stylesheets/bootstrap-responsive.min.css +0 -9
- data/app/stylesheets/bootstrap.css +0 -6039
- data/app/stylesheets/bootstrap.min.css +0 -9
@@ -2,8 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Days::App, type: :controller do
|
4
4
|
describe "admin: users" do
|
5
|
-
|
6
|
-
let(:user) { users(:blogger) }
|
5
|
+
let(:user) { Days::User.create!(login_name: 'blogger', name: 'blogger', password: 'x', password_confirmation: 'x') }
|
7
6
|
|
8
7
|
before { login(user) }
|
9
8
|
|
@@ -12,13 +11,13 @@ describe Days::App, type: :controller do
|
|
12
11
|
|
13
12
|
it_behaves_like 'an admin page'
|
14
13
|
|
15
|
-
it {
|
14
|
+
it { is_expected.to be_ok }
|
16
15
|
|
17
16
|
it "lists up users" do
|
18
|
-
render[:data].
|
17
|
+
expect(render[:data]).to eq(:'admin/users/index')
|
19
18
|
|
20
19
|
users = render[:ivars][:@users]
|
21
|
-
users.
|
20
|
+
expect(users).to eq(Days::User.all)
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -27,19 +26,18 @@ describe Days::App, type: :controller do
|
|
27
26
|
|
28
27
|
it_behaves_like 'an admin page'
|
29
28
|
|
30
|
-
it {
|
29
|
+
it { is_expected.to be_ok }
|
31
30
|
|
32
31
|
it "renders form page" do
|
33
|
-
render[:data].
|
32
|
+
expect(render[:data]).to eq(:'admin/users/form')
|
34
33
|
user = render[:ivars][:@user]
|
35
|
-
user.
|
36
|
-
user.
|
34
|
+
expect(user).to be_a(Days::User)
|
35
|
+
expect(user).to be_new_record
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
39
|
describe "POST /admin/users" do
|
41
40
|
subject { post '/admin/users', params, env }
|
42
|
-
let(:user) { Days::User.last }
|
43
41
|
let(:user_params) do
|
44
42
|
{
|
45
43
|
name: "Writer", login_name: "writer",
|
@@ -51,26 +49,26 @@ describe Days::App, type: :controller do
|
|
51
49
|
it_behaves_like 'an admin page'
|
52
50
|
|
53
51
|
it "creates user" do
|
54
|
-
subject.
|
52
|
+
expect(subject).to be_redirect
|
55
53
|
|
56
54
|
user = Days::User.last
|
57
|
-
user.name.
|
58
|
-
user.login_name.
|
55
|
+
expect(user.name).to eq("Writer")
|
56
|
+
expect(user.login_name).to eq("writer")
|
59
57
|
end
|
60
58
|
|
61
59
|
context "when user is invalid" do
|
62
60
|
before do
|
63
|
-
Days::User.
|
61
|
+
allow_any_instance_of(Days::User).to receive_messages(:valid? => false, :save => false)
|
64
62
|
end
|
65
63
|
|
66
|
-
specify { subject.status.
|
64
|
+
specify { expect(subject.status).to eq(406) } # not acceptable
|
67
65
|
|
68
66
|
it "renders form" do
|
69
|
-
render[:data].
|
67
|
+
expect(render[:data]).to eq(:'admin/users/form')
|
70
68
|
iuser = render[:ivars][:@user]
|
71
|
-
iuser.
|
72
|
-
iuser.name.
|
73
|
-
iuser.login_name.
|
69
|
+
expect(iuser).to be_a_new_record
|
70
|
+
expect(iuser.name).to eq('Writer')
|
71
|
+
expect(iuser.login_name).to eq('writer')
|
74
72
|
end
|
75
73
|
end
|
76
74
|
end
|
@@ -81,14 +79,15 @@ describe Days::App, type: :controller do
|
|
81
79
|
it_behaves_like 'an admin page'
|
82
80
|
|
83
81
|
it "renders form page" do
|
84
|
-
render[:data].
|
85
|
-
render[:ivars][:@user].
|
82
|
+
expect(render[:data]).to eq(:'admin/users/form')
|
83
|
+
expect(render[:ivars][:@user]).to eq(user)
|
86
84
|
end
|
87
85
|
|
88
86
|
context "with invalid user" do
|
89
|
-
let(:
|
87
|
+
let(:user2) { Days::User.create!(login_name: 'blogger2', name: 'blogger2', password: 'x', password_confirmation: 'x') }
|
88
|
+
before { login(user2); user.destroy }
|
90
89
|
|
91
|
-
it {
|
90
|
+
it { is_expected.to be_not_found }
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
@@ -101,45 +100,46 @@ describe Days::App, type: :controller do
|
|
101
100
|
it_behaves_like 'an admin page'
|
102
101
|
|
103
102
|
it "updates user" do
|
104
|
-
subject.
|
105
|
-
URI.parse(subject['Location']).path.
|
103
|
+
expect(subject).to be_redirect
|
104
|
+
expect(URI.parse(subject['Location']).path).to eq(path)
|
106
105
|
|
107
106
|
user.reload
|
108
|
-
user.name.
|
107
|
+
expect(user.name).to eq('Newbie')
|
109
108
|
end
|
110
109
|
|
111
110
|
context "when invalid" do
|
112
111
|
before do
|
113
|
-
Days::User.
|
112
|
+
allow_any_instance_of(Days::User).to receive_messages(:valid? => false, :save => false)
|
114
113
|
end
|
115
114
|
|
116
115
|
it "renders form" do
|
117
|
-
render[:data].
|
116
|
+
expect(render[:data]).to eq(:'admin/users/form')
|
118
117
|
iuser = render[:ivars][:@user]
|
119
|
-
iuser.id.
|
120
|
-
iuser.name.
|
118
|
+
expect(iuser.id).to eq(user.id)
|
119
|
+
expect(iuser.name).to eq('Newbie')
|
121
120
|
end
|
122
121
|
end
|
123
122
|
|
124
123
|
context "with invalid user" do
|
125
|
-
let(:
|
124
|
+
let(:user2) { Days::User.create!(login_name: 'blogger2', name: 'blogger2', password: 'x', password_confirmation: 'x') }
|
125
|
+
before { login(user2); user.destroy }
|
126
126
|
|
127
|
-
it {
|
127
|
+
it { is_expected.to be_not_found }
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
131
|
describe "DELETE /admin/users/:id" do
|
132
|
-
let(:another_user) {
|
132
|
+
let!(:another_user) { Days::User.create!(login_name: 'blogger2', name: 'blogger2', password: 'x', password_confirmation: 'x') }
|
133
133
|
subject { delete "/admin/users/#{another_user.id}", {}, env }
|
134
134
|
|
135
135
|
it_behaves_like 'an admin page'
|
136
136
|
|
137
137
|
it "destroys user" do
|
138
138
|
expect { subject }.to change { Days::User.count }.by(-1)
|
139
|
-
Days::User.where(id: another_user.id).count.
|
139
|
+
expect(Days::User.where(id: another_user.id).count).to be_zero
|
140
140
|
|
141
|
-
subject.
|
142
|
-
URI.parse(subject.location).path.
|
141
|
+
expect(subject).to be_redirect
|
142
|
+
expect(URI.parse(subject.location).path).to eq("/admin/users")
|
143
143
|
end
|
144
144
|
|
145
145
|
context "when tried to delete myself" do
|
@@ -148,15 +148,14 @@ describe Days::App, type: :controller do
|
|
148
148
|
it "doesn't destroy" do
|
149
149
|
expect { subject }.to_not change { Days::User.count }
|
150
150
|
|
151
|
-
subject.status.
|
151
|
+
expect(subject.status).to eq(400)
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
155
|
context "with invalid user" do
|
156
|
-
|
157
|
-
let(:user) { users(:blogger).tap(&:destroy) }
|
156
|
+
before { another_user.destroy }
|
158
157
|
|
159
|
-
it {
|
158
|
+
it { is_expected.to be_not_found }
|
160
159
|
end
|
161
160
|
end
|
162
161
|
end
|
@@ -2,54 +2,58 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Days::App, type: :controller do
|
4
4
|
describe "entry page" do
|
5
|
-
fixtures :categories, :entries
|
6
5
|
let(:path) { '/2012/12/slug' }
|
7
6
|
subject { get path, {}, {} }
|
8
7
|
|
9
8
|
before do
|
10
|
-
Days::App.
|
9
|
+
expect_any_instance_of(Days::App).to receive(:lookup_entry).at_least(:once).with(path).and_return(result)
|
11
10
|
end
|
12
11
|
|
13
|
-
let(:result) {
|
12
|
+
let(:result) { Days::Entry.create!(title: 'foo', body: 'foo') }
|
14
13
|
|
15
|
-
it {
|
14
|
+
it { is_expected.to be_ok }
|
16
15
|
|
17
16
|
it "renders entry.haml" do
|
18
|
-
render[:data].
|
19
|
-
render[:options][:locals][:entry].
|
17
|
+
expect(render[:data]).to eq(:entry)
|
18
|
+
expect(render[:options][:locals][:entry]).to eq(result)
|
20
19
|
end
|
21
20
|
|
22
21
|
context "when lookup_entry returned nil" do
|
23
22
|
let(:result) { nil }
|
24
23
|
|
25
|
-
it {
|
24
|
+
it { is_expected.to be_not_found }
|
26
25
|
end
|
27
26
|
|
28
27
|
context "when lookup_entry returned Array" do
|
29
|
-
let(:result) {
|
28
|
+
let(:result) {
|
29
|
+
[
|
30
|
+
Days::Entry.create!(title: 'foo', body: 'foo'),
|
31
|
+
Days::Entry.create!(title: 'foo2', body: 'foo')
|
32
|
+
]
|
33
|
+
}
|
30
34
|
|
31
|
-
it {
|
35
|
+
it { is_expected.to be_ok }
|
32
36
|
|
33
37
|
it "renders entry.haml" do
|
34
|
-
render[:data].
|
35
|
-
render[:ivars][:@entries].
|
38
|
+
expect(render[:data]).to eq(:entries)
|
39
|
+
expect(render[:ivars][:@entries]).to eq(result)
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
|
40
44
|
describe "redirection from old path" do
|
41
|
-
fixtures :categories, :entries
|
42
45
|
let(:path) { nil }
|
43
46
|
subject { get path, {}, {} }
|
44
47
|
|
45
48
|
before do
|
46
|
-
Days::App.
|
49
|
+
allow_any_instance_of(Days::App).to receive_messages(lookup_entry: nil)
|
50
|
+
Days::Entry.create!(title: 'new', body: 'foo', old_path: '/post/old-path', published_at: Time.local(2012,11,30,0,0,0))
|
47
51
|
end
|
48
52
|
|
49
53
|
context "when entry not found" do
|
50
54
|
let(:path) { '/post/like-old-but-not-exists' }
|
51
55
|
|
52
|
-
it {
|
56
|
+
it { is_expected.to be_not_found }
|
53
57
|
end
|
54
58
|
|
55
59
|
context "when entry found by old path" do
|
@@ -57,98 +61,123 @@ describe Days::App, type: :controller do
|
|
57
61
|
|
58
62
|
it "redirects to present path" do
|
59
63
|
expect(subject.status).to eq 301
|
60
|
-
expect(subject['Location']).to eq '/2012/11/
|
64
|
+
expect(subject['Location']).to eq '/2012/11/new'
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
65
69
|
describe "GET /:year/:month" do
|
66
|
-
fixtures :categories, :entries
|
67
70
|
subject { get '/2012/12', params }
|
68
71
|
let(:params) { {} }
|
69
72
|
|
70
|
-
|
73
|
+
before do
|
74
|
+
Days::Entry.create!(title: '1', body: 'a', published_at: Time.local(2012, 11, 15, 0, 0, 0))
|
75
|
+
Days::Entry.create!(title: '2', body: 'a', published_at: Time.local(2012, 12, 25, 0, 0, 0))
|
76
|
+
Days::Entry.create!(title: '3', body: 'a', published_at: Time.local(2012, 12, 5, 0, 0, 0))
|
77
|
+
end
|
78
|
+
|
79
|
+
it { is_expected.to be_ok }
|
71
80
|
|
72
81
|
it "renders entries" do
|
73
|
-
render[:data].
|
82
|
+
expect(render[:data]).to eq(:entries)
|
74
83
|
|
75
84
|
base = Time.local(2012, 12, 1, 0, 0, 0)
|
76
85
|
range = (base.beginning_of_month .. base.end_of_month)
|
77
|
-
render[:ivars][:@entries].to_a.
|
78
|
-
render[:ivars][:@entries].current_page.
|
86
|
+
expect(render[:ivars][:@entries].to_a).to eq(Days::Entry.where(published_at: range).published.to_a)
|
87
|
+
expect(render[:ivars][:@entries].current_page).to eq(1)
|
79
88
|
end
|
80
89
|
|
81
90
|
context "with page param" do
|
82
91
|
let(:params) { {page: 2} }
|
83
92
|
|
84
93
|
it "renders entries" do
|
85
|
-
render[:data].
|
86
|
-
render[:ivars][:@entries].current_page.
|
94
|
+
expect(render[:data]).to eq(:entries)
|
95
|
+
expect(render[:ivars][:@entries].current_page).to eq(2)
|
87
96
|
end
|
88
97
|
end
|
89
98
|
|
90
99
|
context "with character" do
|
91
100
|
it "returns not found" do
|
92
|
-
get('/aaa/01').
|
93
|
-
get('/2012/bbb').
|
94
|
-
get('/aaa/bbb').
|
101
|
+
expect(get('/aaa/01')).to be_not_found
|
102
|
+
expect(get('/2012/bbb')).to be_not_found
|
103
|
+
expect(get('/aaa/bbb')).to be_not_found
|
95
104
|
end
|
96
105
|
end
|
97
106
|
end
|
98
107
|
|
99
108
|
describe "GET /category/:name" do
|
100
|
-
|
101
|
-
subject { get '/category/daily', params }
|
109
|
+
subject { get '/category/cat', params }
|
102
110
|
let(:params) { {} }
|
103
111
|
|
104
|
-
it {
|
112
|
+
it { is_expected.to be_ok }
|
113
|
+
|
114
|
+
let!(:category) { Days::Category.create!(name: 'cat') }
|
115
|
+
let!(:entry) { Days::Entry.create!(title: 'a', body: 'a', categories: [category]) }
|
105
116
|
|
106
117
|
it "renders entries" do
|
107
|
-
render[:data].
|
118
|
+
expect(render[:data]).to eq(:entries)
|
108
119
|
|
109
|
-
render[:ivars][:@entries].to_a.
|
110
|
-
render[:ivars][:@entries].current_page.
|
120
|
+
expect(render[:ivars][:@entries].to_a).to eq(category.entries.reload.published.to_a)
|
121
|
+
expect(render[:ivars][:@entries].current_page).to eq(1)
|
111
122
|
end
|
112
123
|
|
113
124
|
context "with page param" do
|
114
125
|
let(:params) { {page: 2} }
|
115
126
|
|
116
127
|
it "renders entries" do
|
117
|
-
render[:data].
|
118
|
-
render[:ivars][:@entries].current_page.
|
128
|
+
expect(render[:data]).to eq(:entries)
|
129
|
+
expect(render[:ivars][:@entries].current_page).to eq(2)
|
119
130
|
end
|
120
131
|
end
|
121
132
|
end
|
122
133
|
|
123
134
|
describe "GET /" do
|
124
|
-
fixtures :categories, :entries
|
125
135
|
subject { get '/', params }
|
126
136
|
let(:params) { {} }
|
127
137
|
|
138
|
+
before do
|
139
|
+
Days::Entry.create!(title: '1', body: 'a', published_at: Time.local(2012, 11, 15, 0, 0, 0))
|
140
|
+
Days::Entry.create!(title: '2', body: 'a', published_at: Time.local(2012, 12, 25, 0, 0, 0))
|
141
|
+
end
|
142
|
+
|
143
|
+
let!(:draft) do
|
144
|
+
Days::Entry.create!(title: '3', body: 'a', draft: true)
|
145
|
+
end
|
146
|
+
|
128
147
|
it "renders entries" do
|
129
|
-
render[:data].
|
130
|
-
render[:ivars][:@entries].current_page.
|
131
|
-
render[:ivars][:@entries].
|
148
|
+
expect(render[:data]).to eq(:entries)
|
149
|
+
expect(render[:ivars][:@entries].current_page).to eq(1)
|
150
|
+
expect(render[:ivars][:@entries]).not_to include(draft)
|
132
151
|
end
|
133
152
|
|
134
153
|
context "with page param" do
|
135
154
|
let(:params) { {page: 2} }
|
136
155
|
|
137
156
|
it "renders entries" do
|
138
|
-
render[:data].
|
139
|
-
render[:ivars][:@entries].current_page.
|
157
|
+
expect(render[:data]).to eq(:entries)
|
158
|
+
expect(render[:ivars][:@entries].current_page).to eq(2)
|
140
159
|
end
|
141
160
|
end
|
142
161
|
end
|
143
162
|
|
144
163
|
describe "GET /feed" do
|
145
|
-
fixtures :categories, :entries
|
146
164
|
subject { get '/feed' }
|
147
165
|
|
148
|
-
it {
|
166
|
+
it { is_expected.to be_ok }
|
167
|
+
|
168
|
+
specify do
|
169
|
+
expect(subject.content_type).to eq('application/atom+xml')
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe "GET /feed/category/:name" do
|
174
|
+
let!(:category) { Days::Category.create!(name: 'cat') }
|
175
|
+
subject { get '/feed/category/cat' }
|
176
|
+
|
177
|
+
it { is_expected.to be_ok }
|
149
178
|
|
150
179
|
specify do
|
151
|
-
subject.content_type.
|
180
|
+
expect(subject.content_type).to eq('application/atom+xml')
|
152
181
|
end
|
153
182
|
end
|
154
183
|
end
|
data/spec/helpers_spec.rb
CHANGED
@@ -6,35 +6,24 @@ describe Days::Helpers do
|
|
6
6
|
|
7
7
|
let(:config) do
|
8
8
|
double.tap do |_|
|
9
|
-
_.
|
9
|
+
allow(_).to receive_messages(permalink: permalink)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
let(:entry_a) do
|
14
|
-
Days::Entry.
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:entry_b) do
|
18
|
-
Days::Entry.where(slug: "neko").first
|
19
|
-
end
|
20
|
-
|
21
|
-
before(:all) do
|
22
|
-
Days::Entry.destroy_all
|
23
|
-
entry_a = Days::Entry.create(
|
13
|
+
let!(:entry_a) do
|
14
|
+
Days::Entry.create!(
|
24
15
|
title: 'Sushi', body: 'Sushi!',
|
25
16
|
published_at: Time.local(2012, 12, 31, 9, 24, 42),
|
26
17
|
slug: "sushi"
|
27
18
|
)
|
28
|
-
|
19
|
+
end
|
20
|
+
|
21
|
+
let!(:entry_b) do
|
22
|
+
Days::Entry.create!(
|
29
23
|
title: 'Neko', body: 'Meow!',
|
30
24
|
published_at: Time.local(2012, 12, 31, 19, 14, 32),
|
31
25
|
slug: "neko"
|
32
26
|
)
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
after(:all) do
|
37
|
-
Days::Entry.destroy_all
|
38
27
|
end
|
39
28
|
|
40
29
|
let(:permalink) { "/{year}/{month}/{day}/{hour}/{minute}/{second}/{id}-{slug}" }
|
@@ -42,26 +31,26 @@ describe Days::Helpers do
|
|
42
31
|
describe ".#entry_path" do
|
43
32
|
subject { entry_path(entry_a) }
|
44
33
|
|
45
|
-
it {
|
34
|
+
it { is_expected.to eq("/2012/12/31/09/24/42/#{entry_a.id}-sushi") }
|
46
35
|
|
47
36
|
context "with invalid format (unbalanced parenthesis)" do
|
48
37
|
let(:permalink) { "/{year}/{month}/{day/{hour}/{minute}/{second}/{id}-{slug" }
|
49
38
|
|
50
|
-
it {
|
39
|
+
it { is_expected.to eq("/2012/12/{day/09/24/42/#{entry_a.id}-{slug") }
|
51
40
|
end
|
52
41
|
|
53
42
|
context "with invalid format (invalid tag name)" do
|
54
43
|
let(:permalink) { "/{foo}-{slug}" }
|
55
44
|
|
56
|
-
it {
|
45
|
+
it { is_expected.to eq("/-sushi") }
|
57
46
|
end
|
58
47
|
|
59
48
|
context "with not published entry" do
|
60
49
|
before do
|
61
|
-
entry_a.
|
50
|
+
allow(entry_a).to receive_messages(published?: false)
|
62
51
|
end
|
63
52
|
|
64
|
-
it {
|
53
|
+
it { is_expected.to be_nil }
|
65
54
|
end
|
66
55
|
end
|
67
56
|
|
@@ -71,26 +60,26 @@ describe Days::Helpers do
|
|
71
60
|
|
72
61
|
let(:path) { "/2012/12/31/09/24/42/#{entry_a.id}-sushi" }
|
73
62
|
|
74
|
-
it {
|
63
|
+
it { is_expected.to eq entry_a }
|
75
64
|
|
76
65
|
context "with invalid link" do
|
77
66
|
let(:path) { "/2012/12/31/09/24//#{entry_a.id}-sushi" }
|
78
67
|
|
79
|
-
it {
|
68
|
+
it { is_expected.to be_nil }
|
80
69
|
end
|
81
70
|
|
82
71
|
context "with another format" do
|
83
72
|
let(:permalink) { "/{year}/{month}/{day}/{slug}" }
|
84
73
|
let(:path) { "/2012/12/31/sushi" }
|
85
74
|
|
86
|
-
it {
|
75
|
+
it { is_expected.to eq(entry_a) }
|
87
76
|
end
|
88
77
|
|
89
78
|
context "with invalid format (unbalanced parenthesis)" do
|
90
79
|
let(:permalink) { "/{year}/{month}/{day/{slug}" }
|
91
80
|
let(:path) { "/2012/12/31/sushi" }
|
92
81
|
|
93
|
-
it {
|
82
|
+
it { is_expected.to be_nil }
|
94
83
|
end
|
95
84
|
|
96
85
|
context "with invalid format (invalid tag name)" do
|
@@ -102,7 +91,7 @@ describe Days::Helpers do
|
|
102
91
|
let(:permalink) { "/{year}/{month}/{day}" }
|
103
92
|
let(:path) { "/2012/12/31" }
|
104
93
|
|
105
|
-
it {
|
94
|
+
it { is_expected.to eq([entry_a, entry_b]) }
|
106
95
|
end
|
107
96
|
|
108
97
|
context "when entry has not published" do
|
@@ -111,7 +100,7 @@ describe Days::Helpers do
|
|
111
100
|
entry_a.save
|
112
101
|
end
|
113
102
|
|
114
|
-
it {
|
103
|
+
it { is_expected.to be_nil }
|
115
104
|
end
|
116
105
|
end
|
117
106
|
end
|