Sha256: 8cab9a005017ebe1d6adb5b03189783bc4f751012d82a637a8f16e2f99f9a9de

Contents?: true

Size: 955 Bytes

Versions: 4

Compression:

Stored size: 955 Bytes

Contents

# -*- encoding : utf-8 -*-

describe Card, "validate name" do

  it "should error on name with /" do
    @c = Card.create :name=>"testname/"
    @c.errors[:name].should_not be_blank
  end

  it "should error on junction name  with /" do
    @c = Card.create :name=>"jasmin+ri/ce"
    @c.errors[:name].should_not be_blank
  end

  it "shouldn't create any new cards when name invalid" do
    original_card_count = Card.count
    @c = Card.create :name=>"jasmin+ri/ce"
    Card.count.should == original_card_count
  end

  it "should not allow empty name" do
    @c = Card.new :name=>""
    @c.valid?.should == false
    @c.errors[:name].should_not be_blank
  end

  # maybe the @c.key= should just throw an error, but now it doesn't take anyway
  it "should not allow mismatched name and key" do
    @c = Card.new :name=>"Test"
    @c.key="foo"
    #@c.key.should == 'test'
    @c.valid?.should == false
    #@c.errors[:key].should_not be_blank
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wagn-1.13.0 spec/models/card/validation_spec.rb
wagn-1.13.0.pre2 spec/models/card/validation_spec.rb
wagn-1.13.0.pre1 spec/models/card/validation_spec.rb
wagn-1.13.0.pre spec/models/card/validation_spec.rb