Sha256: 4876a6eb2e37d5fd2ebf08c59c347ba666dfe361712f6596229b0ca869478528

Contents?: true

Size: 982 Bytes

Versions: 30

Compression:

Stored size: 982 Bytes

Contents

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

describe Card, "validate name" do

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

  it "should error on junction name  with /" do
    @c = Card.create :name=>"jasmin+ri/ce"
    expect(@c.errors[:name]).not_to 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"
    expect(Card.count).to eq(original_card_count)
  end

  it "should not allow empty name" do
    @c = Card.new :name=>""
    expect(@c.valid?).to eq(false)
    expect(@c.errors[:name]).not_to 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'
    expect(@c.valid?).to eq(false)
    #@c.errors[:key].should_not be_blank
  end

end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
card-1.16.6 spec/models/card/validation_spec.rb
card-1.16.5 spec/models/card/validation_spec.rb
card-1.16.4 spec/models/card/validation_spec.rb
card-1.16.3 spec/models/card/validation_spec.rb
card-1.16.2 spec/models/card/validation_spec.rb
card-1.16.1 spec/models/card/validation_spec.rb
card-1.16.0 spec/models/card/validation_spec.rb
card-1.15.7 spec/models/card/validation_spec.rb
card-1.15.6 spec/models/card/validation_spec.rb
card-1.15.5 spec/models/card/validation_spec.rb
card-1.15.4 spec/models/card/validation_spec.rb
card-1.15.3 spec/models/card/validation_spec.rb
card-1.15.2 spec/models/card/validation_spec.rb
card-1.15.1 spec/models/card/validation_spec.rb
card-1.15.0 spec/models/card/validation_spec.rb
card-1.15.pre2 spec/models/card/validation_spec.rb
card-1.15.pre spec/models/card/validation_spec.rb
wagn-1.14.9 spec/models/card/validation_spec.rb
wagn-1.14.8 spec/models/card/validation_spec.rb
wagn-1.14.7 spec/models/card/validation_spec.rb