|
|
|
@ -12,19 +12,22 @@ |
|
|
|
|
require 'spec_helper' |
|
|
|
|
|
|
|
|
|
describe Project do |
|
|
|
|
let(:project) { FactoryGirl.build(:project) } |
|
|
|
|
let(:admin) { FactoryGirl.create(:admin) } |
|
|
|
|
|
|
|
|
|
describe Project::STATUS_ACTIVE do |
|
|
|
|
it "equals 1" do |
|
|
|
|
# spec that STATUS_ACTIVE has the correct value |
|
|
|
|
Project::STATUS_ACTIVE.should == 1 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#active?" do |
|
|
|
|
before do |
|
|
|
|
# stub out the actual value of the constant |
|
|
|
|
stub_const('Project::STATUS_ACTIVE', 42) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "is active when :status equals STATUS_ACTIVE" do |
|
|
|
|
project = FactoryGirl.create :project, :status => 42 |
|
|
|
|
project.should be_active |
|
|
|
@ -35,4 +38,15 @@ describe Project do |
|
|
|
|
project.should_not be_active |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "associated_project_candidates" do |
|
|
|
|
let(:project_type) { FactoryGirl.create(:project_type, :allows_association => true) } |
|
|
|
|
|
|
|
|
|
it "should not include the project" do |
|
|
|
|
project.project_type = project_type |
|
|
|
|
project.save! |
|
|
|
|
|
|
|
|
|
project.associated_project_candidates(admin).should be_empty |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|