Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created December 25, 2009 18:33
Show Gist options
  • Save edipofederle/263705 to your computer and use it in GitHub Desktop.
Save edipofederle/263705 to your computer and use it in GitHub Desktop.
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