Sha256: c8ac6765d21a9f1edcb4eb27c012c0a5a3743fc4a7ac00926a0bf1cd69085986

Contents?: true

Size: 709 Bytes

Versions: 5

Compression:

Stored size: 709 Bytes

Contents

require_relative "rails_helper"

RSpec.describe MyModel, type: :model do
  subject(:model) { described_class.new }

  it { is_expected.to validate_presence_of(:name) }

  it "should allow integer values for age" do
    model.age = 1
    expect(model.age).to eq 1
  end

  it "should allow string values for name" do
    model.name = "test"
    expect(model.name).to eq "test"
  end

  it "should be invalid with invalid name" do
    model.name = nil
    expect(model).to be_invalid
  end

  it "should convert integer values for name" do
    model.name = 1
    expect(model.name).to eq "1"
  end

  it "should not allow string values for age" do
    model.age = "test"
    expect(model.age).to eq 0
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ai_refactor-0.5.4 examples/ex1_input_spec.rb
ai_refactor-0.5.3 examples/ex1_input_spec.rb
ai_refactor-0.5.2 examples/ex1_input_spec.rb
ai_refactor-0.5.1 examples/ex1_input_spec.rb
ai_refactor-0.5.0 examples/ex1_input_spec.rb