Sha256: 6c0ebfa8d433a0e783ba2d07155f1056107248386c8090cb2af790d3ee033203

Contents?: true

Size: 977 Bytes

Versions: 14

Compression:

Stored size: 977 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

14 entries across 14 versions & 1 rubygems

Version Path
card-1.17.4 spec/models/card/validation_spec.rb
card-1.17.3 spec/models/card/validation_spec.rb
card-1.17.2 spec/models/card/validation_spec.rb
card-1.17.1 spec/models/card/validation_spec.rb
card-1.17.0 spec/models/card/validation_spec.rb
card-1.16.15 spec/models/card/validation_spec.rb
card-1.16.14 spec/models/card/validation_spec.rb
card-1.16.13 spec/models/card/validation_spec.rb
card-1.16.12 spec/models/card/validation_spec.rb
card-1.16.11 spec/models/card/validation_spec.rb
card-1.16.10 spec/models/card/validation_spec.rb
card-1.16.9 spec/models/card/validation_spec.rb
card-1.16.8 spec/models/card/validation_spec.rb
card-1.16.7 spec/models/card/validation_spec.rb