Sha256: 0c45920ab9c829ba48a7b2c440f18129c291d1e74efae5252960ff52f340c729

Contents?: true

Size: 1.05 KB

Versions: 20

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true
# This file demonstrates how simple creation, reading updating and deletion (CRUD)
# can be done through LeapSalesforce classes
# Depending on validation rules and mandatory fields this may or may not work

RSpec.describe 'Contact CRUD' do
  let(:uniq_value) { "UNIQ #{Faker::Name.first_name} #{Faker::Name.middle_name}" }
  let(:updated_value) { "New #{Faker::Name.first_name} #{Faker::Name.neutral_first_name}" }
  it 'Create using factory bot' do
    @contact = FactoryBot.create(:contact)
  end
  it 'Read contact by name' do
    FactoryBot.create(:contact, first_name: uniq_value)
    @contact = Contact.find(first_name: uniq_value)
    retrieved_first_name = @contact.first_name
    expect(retrieved_first_name).to eq uniq_value
  end
  it 'Updates contacts name' do
    @contact = FactoryBot.create(:contact, first_name: uniq_value)
    @contact.first_name = updated_value
    expect(@contact.find.first_name).to eq updated_value
  end
  after { @contact.delete } # Delete data after each action. Comment out if you want data to remain
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
leap_salesforce-1.5.0 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.4.4 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.4.3 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.4.2 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.4.1 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.4.0 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.3.1 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.3.0 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.2.2 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.2.1 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.2.0 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.1.2 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.1.1 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.1.0 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.0.5 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.0.4 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.0.3 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.0.2 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.0.1 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb
leap_salesforce-1.0.0 lib/leap_salesforce/generator/templates/spec/crud_eg_spec.rb.erb