Sha256: dc57f5b7ccdc0ec3dbd65cddad0530ff305e3b6df70a886177f0f2d5c48fb39d

Contents?: true

Size: 695 Bytes

Versions: 4

Compression:

Stored size: 695 Bytes

Contents

require 'spec_helper'

describe "mist/posts/index" do
  NUMBERS = %w(one two three four five six seven eight nine ten)
  
  before(:each) do
    list = []
    NUMBERS.each do |n|
      list << create(:post, :title => n, :published => true, :content => "#{n}-Paragraph1\n\n#{n}-Paragraph2")
    end
    assign(:posts, list)
  end

  it "renders the full content of the first post" do
    render
    rendered.should =~ /one-Paragraph1/
    rendered.should =~ /one-Paragraph2/
  end
  
  it "renders only the first paragraph of all other posts" do
    render
    NUMBERS[1..-1].each do |n|
      rendered.should =~ /#{n}-Paragraph1/
      rendered.should_not =~ /#{n}-Paragraph2/
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mist-0.6.3 spec/views/mist/posts/index.html.erb_spec.rb
mist-0.6.2 spec/views/mist/posts/index.html.erb_spec.rb
mist-0.6.1 spec/views/mist/posts/index.html.erb_spec.rb
mist-0.6.0 spec/views/mist/posts/index.html.erb_spec.rb