public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
Michael Hartl (author)
Thu Feb 21 13:18:15 -0800 2008
commit  26772b4ac48d2670fbd5eb6f8e03c0632dc33d0c
tree    22cdceb6d59145aa7e65f5891f70d0e727fc6860
parent  52afde02ab5f67f40cf26a3a1dbc9a1b62cfe422
insoshi / spec / models / photo_spec.rb
100644 34 lines (25 sloc) 0.772 kb
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
require File.dirname(__FILE__) + '/../spec_helper'
 
describe Photo do
  
  before(:each) do
    @filename = "rails.png"
    @person = people(:quentin)
    @image = uploaded_file(@filename, "image/png")
  end
  
  it "should upload successfully" do
    new_photo.should be_valid
  end
  
  it "should be able to make a primary photo" do
    new_photo(:primary => true).should be_primary
  end
  
  it "should be able to make a non-primary photo" do
    new_photo(:primary => false).should_not be_primary
  end
  
  
  it "should have an associated person" do
    new_photo.person.should == @person
  end
  
  private
  
    def new_photo(options = {})
      Photo.new({ :uploaded_data => @image,
                  :person => @person }.merge(options))
    end
end