-
-
Save tpendragon/8959086 to your computer and use it in GitHub Desktop.
This file contains 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 'spec_helper' | |
describe Project do | |
let!(:user) { FactoryGirl.create(:user) } | |
let!(:plan) { FactoryGirl.create(:plan_with_subscription, user: user) } | |
it "has a valid factory" do | |
FactoryGirl.create(:project, user: user). should be_valid | |
end | |
describe "#location_state_city" do | |
let(:project) { FactoryGirl.build(:project, user: user, state: "TN", city: "Nashville") } | |
it 'returns the state and city of the project' do | |
project.location_state_city.should == "Nashville, TN" | |
end | |
end | |
describe "#ready_to_publish?" do | |
required_fields = %w{city state company_name email_address phone_number description category sub_category} | |
required_fields.each do |field| | |
it "returns false if the project is missing a #{field}" do | |
FactoryGirl.build(:project, :user => user, field.to_sym => nil).ready_to_publish?.should == false | |
end | |
end | |
it 'returns false if the project has not been approved' do | |
FactoryGirl.build(:project, user: user, status: "not_approved").ready_to_publish?.should == false | |
end | |
it 'returns true if the project is not missing requisite fields and project is approved' do | |
FactoryGirl.build(:project, user: user).ready_to_publish?.should == true | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment