Created
December 25, 2009 18:33
-
-
Save edipofederle/263705 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../spec_helper' | |
module ProjectSpecHelper | |
def valid_project_attributes | |
{ :name => 'app_test', | |
:url => 'git://my_app', | |
:email => '[email protected]' } | |
end | |
def invalid_project_attributes | |
{ :name => "", | |
:url => 'http://my_app', | |
:email => 'edipoil.com' } | |
end | |
end | |
describe Project do | |
include ProjectSpecHelper | |
it "should have project folder in public RAILS_ROOT" do | |
Project::BASE_PATH.should eql("#{RAILS_ROOT}/public/projects") | |
end | |
before :each do | |
@project = Project.new | |
end | |
it "should not create a valid project" do | |
@project.attributes = invalid_project_attributes | |
@project.should_not be_valid | |
end | |
it "should create a valid project" do | |
@project.attributes = valid_project_attributes | |
@project.should be_valid | |
end | |
it "should have a url start at git://" do | |
@project.url ="git://dsf" | |
@project.url.should == "git://dsf" | |
end | |
it "should fail with url not start with git://" do | |
@project.attributes = invalid_project_attributes | |
@project.should be_invalid | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment