Sha256: 91ed5c3d62eecc25fdcbe34723ac583317db3d54c0addc0018c45d3013850904
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
require 'spec_helper' describe Auth::Model do context "given nonexisting model name" do subject { Auth::Model.new(:nonexisting_user) } it "should fail silently during initialization because it might not have been generated yet" do proc { subject }.should_not raise_error end end context "with default options" do subject { Auth::Model.new(:user) } before(:each) do Dispatcher.cleanup_application Dispatcher.reload_application subject.apply_options! end it "should validate presence of :email on User" do error_on(User, :email).should == "can't be blank" end it "should use :core behavior" do subject.behaviors.should include(:core) end end context "with an empty :behaviors option" do subject { Auth::Model.new(:user, :behaviors => []) } before(:each) do Dispatcher.cleanup_application Dispatcher.reload_application subject.apply_options! end it "should have no behaviors" do subject.behaviors.should be_empty end end context "with a hash for :with option" do subject { Auth::Model.new(:user, :with => { :secret => :passwd, :format => /^.{8}$/, :message => "must be exactly 8 characters" })} before(:each) do Dispatcher.cleanup_application Dispatcher.reload_application subject.apply_options! end it "should validate presence of :email on User" do error_on(User, :email).should == "can't be blank" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sparkly-auth-1.0.2 | spec/lib/auth/model_spec.rb |
sparkly-auth-1.0.1 | spec/lib/auth/model_spec.rb |
sparkly-auth-1.0.0 | spec/lib/auth/model_spec.rb |