spec/mongoid/token_spec.rb in mongoid_token-2.1.0 vs spec/mongoid/token_spec.rb in mongoid_token-2.1.1

- old
+ new

@@ -54,9 +54,15 @@ it "should disable `to_param` overrides" do document_class.send(:token, :override_to_param => false) expect(document.to_param).to_not eq document.token end + it "should return id when token does not exist when calling `to_param`" do + document_class.send(:token, :override_to_param => true) + document.unset :token + expect(document.to_param).to eq document.id.to_s + end + describe "contains" do context "with :alphanumeric" do it "should contain only letters and numbers" do document_class.send(:token, :contains => :alphanumeric, :length => 64) expect(document.token).to match(/[A-Za-z0-9]{64}/)