Sha256: cc93bffd185e5ecc8a68f0b6be937ad983bcc66c5d99aec9392f69ac218bafba
Contents?: true
Size: 1.79 KB
Versions: 3
Compression:
Stored size: 1.79 KB
Contents
require 'spec_helper' describe PostsController, :type => :controller do before(:each) do activate_authlogic end describe :index do it "should display a list of posts" do 2.times { |i| FactoryGirl.create(:spud_post) } get :index, {:blog_key => 'blog'} assigns(:posts).count.should be > 1 end it "should not display any posts" do Spud::Blog.config.query_for_user = ->(user){ if user.blank? '1=0' else {} end } get :index, {:blog_key => 'blog'} assigns(:posts).count.should be 0 Spud::Blog.config.query_for_user = nil end end describe :create_comment do it "should create a comment" do @post = FactoryGirl.create(:spud_post) post :create_comment, :blog_key => 'blog', :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"} @post.comments.length.should be > 0 end it "should approve a comment by default if default_comment_approval is true" do Spud::Blog.configure do |config| config.default_comment_approval = true end @post = FactoryGirl.create(:spud_post) post :create_comment, :blog_key => 'blog', :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"} @post.comments.first.approved.should be_true end it "should not approve a comment by default if default_comment_approval is false" do Spud::Blog.configure do |config| config.default_comment_approval = false end @post = FactoryGirl.create(:spud_post) post :create_comment, :blog_key => 'blog', :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"} @post.comments.first.approved.should be_false end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tb_blog-1.3.0.beta1 | spec/controllers/posts_controller_spec.rb |
tb_blog-1.2.1 | spec/controllers/posts_controller_spec.rb |
tb_blog-1.2.0 | spec/controllers/posts_controller_spec.rb |