Sha256: 9450e80e5abdfa5893fc69ba062bcf06454b10db8b3be9c5bca592fe22f99268

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

describe "ActiveRecord::Base" do
  it "should have validates_subdomain_format_of which runs SubdomainRoutes.valid_subdomain? against the attributes" do
    class User < ActiveRecord::Base
      attr_accessor :subdomain
      User.validates_subdomain_format_of :subdomain
    end
    SubdomainRoutes.should_receive(:valid_subdomain?).with("mholling").and_return(true)
    User.new(:subdomain => "mholling").valid?.should be_true
    SubdomainRoutes.should_receive(:valid_subdomain?).with("mholling").and_return(nil)
    User.new(:subdomain => "mholling").valid?.should be_false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mholling-subdomain_routes-0.1.0 spec/validations_spec.rb