/
blog_post_test.rb
42 lines (34 loc) · 1.03 KB
/
blog_post_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require File.dirname(__FILE__) + '/../test_helper'
class BlogPostTest < ActionController::TestCase
tests Cms::ContentController
def setup
setup_stubs
create_baseline_data
end
# def teardown
# destroy_baseline_data
# end
def test_show_post
get :show, :path => ["blog", "post"],
:year => @first_post.year,
:month => @first_post.month,
:day => @first_post.day,
:slug => @first_post.slug
#log @response.body
assert_response :success
assert_select "title", @first_post.name
assert_select ".blog_post", 1
assert_select "#blog_post_#{@first_post.id}" do
assert_select "h2 a", @first_post.name
assert_select "p.body", @first_post.body
assert_select "p.meta a", "General"
assert_select "p.meta a", "0 Comments"
end
end
# def test_non_existent_slug_should_return_404
# get :show, :path => ["blog", "post"],
# :year => 2005, :month => 6, :day => 14,
# :slug => "not-here"
# assert_response :not_found
# end
end