spec/models/site_spec.rb in locomotive_cms-0.0.2.4 vs spec/models/site_spec.rb in locomotive_cms-0.0.2.5

- old
+ new

@@ -1,9 +1,13 @@ require 'spec_helper' describe Site do + before(:each) do + Locomotive.stubs(:add_heroku_domain).returns(true) + end + it 'should have a valid factory' do Factory.build(:site).should be_valid end ## Validations ## @@ -18,16 +22,16 @@ site = Factory.build(:site, :subdomain => nil) site.should_not be_valid site.errors[:subdomain].should == ["can't be blank"] end - %w{test foo_bar test42}.each do |subdomain| + %w{test test42}.each do |subdomain| it "should accept subdomain like '#{subdomain}'" do Factory.build(:site, :subdomain => subdomain).should be_valid end end - ['-', '_test', 'test_', 't est', '42', '42test'].each do |subdomain| + ['-', '_test', 'test_', 't est', '42', '42test', 'foo_bar'].each do |subdomain| it "should not accept subdomain like '#{subdomain}'" do (site = Factory.build(:site, :subdomain => subdomain)).should_not be_valid site.errors[:subdomain].should == ['is invalid'] end end \ No newline at end of file