Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper.rb') describe 'posts/index' do before(:each) do @controller = Posts.new(fake_request) @posts = [Post.create(:body => 'Merb', :created_at => Time.now), Post.create(:body => 'Rocks!', :created_at => Time.now)] @controller.instance_variable_set(:@posts, @posts) @body = @controller.render(:index) puts @body end it 'should have a containing div for the posts' do @body.should have_selector('div#posts.container') end it 'should have a div for each individual post' do @posts.each do |post| @body.should have_selector("div#posts.container div#post_#{post.id}.post") end end it 'should have the contents of each post inside a div with an id and class' do #@posts.each do |post| post = @posts[0] @body.should have_tag(:div, :id => "post_#{post.id}", :class => :post).with_tag(:p, :class => :body) do |p| p.should contain post.body end #end end after(:each) do Post.all.each { |post| post.destroy } end end
This paste will be private.
From the Design Piracy series on my blog: