diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..65d299249 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +.DS_Store diff --git a/README.md b/README.md index 9056d23f4..65e72784e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,20 @@ -# The DMV +DMV Project +What I Did -This is the starter repo for the BE Mod1 DMV project. +This project simulates a DMV system using Ruby and follows Object-Oriented Programming (OOP) principles and Test-Driven Development (TDD). + +Facility Management: Created a Facility class to track DMV locations and their services. + +Vehicle Management: Built a Vehicle class to handle vehicle registrations, plate types (regular, electric, antique), and registration dates. + +Registrant Services: Added a Registrant class to manage individual permits, written tests, road tests, and license renewals. + +Data Integration: Integrated external data sources using the DmvDataService class to fetch DMV facilities and vehicle registration data. + +Factories: Created VehicleFactory and FacilityFactory classes to process and build objects from external data. +Testing: Used RSpec to test all classes, methods, and edge cases for correctness and reliability. +Key Features +Vehicle registration and classification. +Facility services like written tests, road tests, and license renewals. +Importing and managing DMV data from external APIs. +Comprehensive testing to ensure functionality. \ No newline at end of file diff --git a/lib/dmv.rb b/lib/dmv.rb index f9e59bdf3..11e2fd3eb 100644 --- a/lib/dmv.rb +++ b/lib/dmv.rb @@ -1,16 +1,40 @@ +<<<<<<< HEAD +# The Dmv class represents the core DMV system that manages facilities. class Dmv + # Provides read access to the list of facilities. + attr_reader :facilities + # Initializes the Dmv object with an empty array of facilities. +======= +# The Dmv class represents the DMV system that manages facilities. +class Dmv + attr_reader :facilities + + # Initializes an empty array to store Facility objects. +>>>>>>> feature/vehicle-class def initialize - @facilities = [] + @facilities = [] # Array to store Facility objects end + # Adds a facility to the DMV. +<<<<<<< HEAD + # @param facility [Facility] The facility object to be added. +======= + # @param facility [Facility] The facility to add. +>>>>>>> feature/vehicle-class def add_facility(facility) @facilities << facility end + # Returns facilities that offer a specific service. +<<<<<<< HEAD + # @param service [String] The service to search for. +======= + # @param service [String] The service name to search for. +>>>>>>> feature/vehicle-class + # @return [Array] List of facilities providing the service. def facilities_offering_service(service) - @facilities.find do |facility| - facility.services.include?(service) - end + @facilities.select { |facility| facility.services.include?(service) } end end + diff --git a/lib/dmv_data_service.rb b/lib/dmv_data_service.rb index 7c979a82c..cf4a922d8 100644 --- a/lib/dmv_data_service.rb +++ b/lib/dmv_data_service.rb @@ -1,25 +1,33 @@ require 'faraday' require 'json' +# The DmvDataService class retrieves external data from an API. class DmvDataService + # Loads data from a given URL + # @param source: String URL for the data source + # @return: Parsed JSON data def load_data(source) response = Faraday.get(source) JSON.parse(response.body, symbolize_names: true) end + # Retrieves Washington EV Registration data def wa_ev_registrations - @wa_ev_registrations ||= load_data('https://data.wa.gov/resource/rpr4-cgyd.json') + load_data('https://data.wa.gov/resource/rpr4-cgyd.json') end + # Retrieves Colorado DMV Office Locations data def co_dmv_office_locations - @co_dmv_office_locations ||= load_data('https://data.colorado.gov/resource/dsw3-mrn4.json') + load_data('https://data.colorado.gov/resource/dsw3-mrn4.json') end + # Retrieves New York DMV Office Locations data def ny_dmv_office_locations - @ny_dmv_office_locations ||= load_data('https://data.ny.gov/resource/9upz-c7xg.json') + load_data('https://data.ny.gov/resource/9upz-c7xg.json') end + # Retrieves Missouri DMV Office Locations data def mo_dmv_office_locations - @mo_dmv_office_locations ||= load_data('https://data.mo.gov/resource/835g-7keg.json') + load_data('https://data.mo.gov/resource/835g-7keg.json') end end diff --git a/lib/facility.rb b/lib/facility.rb index a65757687..68466f936 100644 --- a/lib/facility.rb +++ b/lib/facility.rb @@ -1,14 +1,51 @@ +<<<<<<< HEAD +# Updated Facility class with initializer to accept a hash of details class Facility attr_reader :name, :address, :phone, :services - def initialize(name, address, phone) - @name = name - @address = address - @phone = phone + # Initialize with a hash containing the facility details +======= +require_relative 'vehicle' + +class Facility + attr_reader :name, :address, :phone, :services, :registered_vehicles, :collected_fees + + # Initializes a Facility with details and an empty services list +>>>>>>> feature/vehicle-class + def initialize(details) + @name = details[:name] + @address = details[:address] + @phone = details[:phone] @services = [] +<<<<<<< HEAD end - def add_services(service) + # Add a service to the facility + def add_service(service) @services << service end end + +======= + @registered_vehicles = [] + @collected_fees = 0 + end + + # Adds a service to the facility + def add_service(service) + @services << service + end + + class Facility + attr_reader :name, :services + + def initialize(name) + @name = name + @services = [] + end + + def add_service(service) + @services << service + end + end +>>>>>>> feature/vehicle-class diff --git a/lib/facility_factory.rb b/lib/facility_factory.rb new file mode 100644 index 000000000..c316c6884 --- /dev/null +++ b/lib/facility_factory.rb @@ -0,0 +1,25 @@ +<<<<<<< HEAD +======= + +>>>>>>> feature/facility-class +require_relative 'facility' + +# The FacilityFactory class creates Facility objects from external data sources. +class FacilityFactory + # Creates an array of Facility objects from external data. + # @param data [Array] An array of facility details from the API. + # @return [Array] An array of Facility objects. + def create_facilities(data) + data.map do |facility_data| + Facility.new({ + name: facility_data[:dmv_office], + address: "#{facility_data[:address_li]}, #{facility_data[:city]}", + phone: facility_data[:phone] + }) + end + end +<<<<<<< HEAD +end +======= +end +>>>>>>> feature/facility-class diff --git a/lib/registrant.rb b/lib/registrant.rb new file mode 100644 index 000000000..e97ca8f14 --- /dev/null +++ b/lib/registrant.rb @@ -0,0 +1,25 @@ +# The Registrant class represents a person who interacts with DMV services. +# A registrant can have a permit and progress to earning a license. +class Registrant + attr_reader :name, :age, :license_data + + # Initializes the registrant with a name, age, and optional permit status. + # license_data is initialized to track written, road, and renewed license status. + def initialize(name, age, permit = false) + @name = name + @age = age + @permit = permit + @license_data = { written: false, license: false, renewed: false } + end + + # Checks if the registrant has a permit. + def permit? + @permit + end + + # Allows a registrant to earn a permit. + def earn_permit + @permit = true + end +end + diff --git a/lib/vehicle.rb b/lib/vehicle.rb index 49ae83672..ab50b989a 100644 --- a/lib/vehicle.rb +++ b/lib/vehicle.rb @@ -1,25 +1,106 @@ -require 'date' +require_relative 'vehicle' +<<<<<<< HEAD +<<<<<<< HEAD +# The Vehicle class represents a registered vehicle. class Vehicle - attr_reader :vin, - :year, - :make, - :model, - :engine - - def initialize(vehicle_details) - @vin = vehicle_details[:vin] - @year = vehicle_details[:year] - @make = vehicle_details[:make] - @model = vehicle_details[:model] - @engine = vehicle_details[:engine] +<<<<<<< HEAD + attr_reader :vin, :year, :make, :model, :engine, :registration_date, :plate_type +======= + attr_reader :vin, :year, :make, :model, :engine, :registration_date +>>>>>>> feature/facility-class + +======= +# The Vehicle class represents a car, truck, or other registered vehicle. +class Vehicle + attr_reader :vin, :year, :make, :model, :engine, :registration_date, :plate_type + + # Initializes a Vehicle object with attributes +>>>>>>> feature/vehicle-class + def initialize(details) + @vin = details[:vin] + @year = details[:year] + @make = details[:make] + @model = details[:model] + @engine = details[:engine] +<<<<<<< HEAD +<<<<<<< HEAD + @registration_date = nil + @plate_type = nil + end + + # Registers the vehicle and determines the plate type. +======= + @registration_date = nil # Default: not registered + @plate_type = nil # Default: no plate type + end + + # Registers the vehicle and assigns a plate type +>>>>>>> feature/vehicle-class + def register + @registration_date = Date.today + @plate_type = determine_plate_type + end + +<<<<<<< HEAD + # Determines plate type. + def determine_plate_type + return :antique if antique? + return :ev if electric? + :regular +======= + @registration_date = nil # Default value +>>>>>>> feature/facility-class end + # Check if the vehicle is antique +======= + # Determines the plate type: antique, electric, or regular + def determine_plate_type + if antique? + :antique + elsif electric? + :ev + else + :regular + end + end + + # Determines if the vehicle is antique (older than 25 years) +>>>>>>> feature/vehicle-class def antique? Date.today.year - @year > 25 end - def electric_vehicle? +<<<<<<< HEAD +<<<<<<< HEAD +======= + # Determines if the vehicle is electric +>>>>>>> feature/vehicle-class + def electric? @engine == :ev +======= + # Register the vehicle + def register + @registration_date = Date.today +>>>>>>> feature/facility-class +======= +# The VehicleFactory class creates Vehicle objects from external data sources. +class VehicleFactory + # Creates an array of Vehicle objects from external data. + # @param data [Array] An array of vehicle details from the API. + # @return [Array] An array of Vehicle objects. + def create_vehicles(data) + data.map do |vehicle_data| + Vehicle.new({ + vin: vehicle_data[:vin_1_10], + year: vehicle_data[:model_year].to_i, + make: vehicle_data[:make], + model: vehicle_data[:model], + engine: :ev # Since data is for EV registrations, set engine type to :ev + }) + end +>>>>>>> feature/registrant-factories end end + diff --git a/lib/vehicle_factory.rb b/lib/vehicle_factory.rb new file mode 100644 index 000000000..c23cf7944 --- /dev/null +++ b/lib/vehicle_factory.rb @@ -0,0 +1,19 @@ +require_relative 'vehicle' + +# The VehicleFactory class is responsible for creating Vehicle objects from external data. +class VehicleFactory + # Creates Vehicle objects from provided data + # @param data: Array of hashes containing vehicle details + # @return: Array of Vehicle objects + def create_vehicles(data) + data.map do |vehicle_data| + Vehicle.new({ + vin: vehicle_data[:vin_1_10], + year: vehicle_data[:model_year].to_i, + make: vehicle_data[:make], + model: vehicle_data[:model], + engine: :ev # Default engine type to electric for external EV data + }) + end + end +end diff --git a/spec/dmv_spec.rb b/spec/dmv_spec.rb index 70308d270..fe222e8ac 100644 --- a/spec/dmv_spec.rb +++ b/spec/dmv_spec.rb @@ -1,43 +1,96 @@ -require 'spec_helper' +<<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> feature/vehicle-class +require 'rspec' +require './lib/dmv' +# Test suite for the Dmv class +======= +>>>>>>> feature/facility-class RSpec.describe Dmv do before(:each) do +<<<<<<< HEAD @dmv = Dmv.new - @facility_1 = Facility.new({name: 'DMV Tremont Branch', address: '2855 Tremont Place Suite 118 Denver CO 80205', phone: '(720) 865-4600'}) - @facility_2 = Facility.new({name: 'DMV Northeast Branch', address: '4685 Peoria Street Suite 101 Denver CO 80239', phone: '(720) 865-4600'}) - @facility_3 = Facility.new({name: 'DMV Northwest Branch', address: '3698 W. 44th Avenue Denver CO 80211', phone: '(720) 865-4600'}) end - describe '#initialize' do - it 'can initialize' do - expect(@dmv).to be_an_instance_of(Dmv) - expect(@dmv.facilities).to eq([]) - end +<<<<<<< HEAD + it 'initializes with no facilities' do + expect(@dmv.facilities).to eq([]) # Facilities start as an empty array end - describe '#add facilities' do - it 'can add available facilities' do - expect(@dmv.facilities).to eq([]) - @dmv.add_facility(@facility_1) - expect(@dmv.facilities).to eq([@facility_1]) - end + it 'can add facilities' do + mock_facility = double('Facility', services: ['Renew License']) + @dmv.add_facility(mock_facility) + + expect(@dmv.facilities).to include(mock_facility) + end + + it 'can find facilities offering a specific service' do + facility_1 = double('Facility', services: ['Vehicle Registration']) + facility_2 = double('Facility', services: ['Renew License']) + @dmv.add_facility(facility_1) + @dmv.add_facility(facility_2) + + result = @dmv.facilities_offering_service('Renew License') + expect(result).to eq([facility_2]) +======= + it 'can initialize with no facilities' do + expect(@dmv.facilities).to eq([]) + end + + it 'can add facilities' do + # Pass a hash for Facility initialization + facility = Facility.new({ name: 'DMV Branch', address: '123 St', phone: '555-5555' }) + @dmv.add_facility(facility) + + expect(@dmv.facilities).to include(facility) + end + + it 'can find facilities offering specific services' do + facility_1 = Facility.new({ name: 'DMV 1', address: '123 St', phone: '555-5551' }) + facility_2 = Facility.new({ name: 'DMV 2', address: '456 St', phone: '555-5552' }) + facility_1.add_service('Vehicle Registration') + facility_2.add_service('Renew License') + + @dmv.add_facility(facility_1) + @dmv.add_facility(facility_2) + + expect(@dmv.facilities_offering_service('Vehicle Registration')).to eq([facility_1]) + expect(@dmv.facilities_offering_service('Renew License')).to eq([facility_2]) +>>>>>>> feature/facility-class +======= + @dmv = Dmv.new # Creates a new Dmv instance before each test end - describe '#facilities_offering_service' do - it 'can return list of facilities offering a specified Service' do - @facility_1.add_service('New Drivers License') - @facility_1.add_service('Renew Drivers License') - @facility_2.add_service('New Drivers License') - @facility_2.add_service('Road Test') - @facility_2.add_service('Written Test') - @facility_3.add_service('New Drivers License') - @facility_3.add_service('Road Test') + it 'can initialize' do + expect(@dmv).to be_a(Dmv) # Checks that @dmv is an instance of Dmv + expect(@dmv.facilities).to eq([]) # Facilities array should start empty + end - @dmv.add_facility(@facility_1) - @dmv.add_facility(@facility_2) - @dmv.add_facility(@facility_3) + it 'can add facilities' do + mock_facility_1 = double('Facility', services: ['Renew License']) + mock_facility_2 = double('Facility', services: ['Vehicle Registration']) - expect(@dmv.facilities_offering_service('Road Test')).to eq([@facility_2, @facility_3]) - end + @dmv.add_facility(mock_facility_1) + @dmv.add_facility(mock_facility_2) + + expect(@dmv.facilities).to include(mock_facility_1) + expect(@dmv.facilities).to include(mock_facility_2) + end + + it 'can return facilities offering a specified service' do + facility_1 = double('Facility', services: ['Renew License']) + facility_2 = double('Facility', services: ['Vehicle Registration']) + facility_3 = double('Facility', services: ['Renew License', 'Road Test']) + + @dmv.add_facility(facility_1) + @dmv.add_facility(facility_2) + @dmv.add_facility(facility_3) + + result = @dmv.facilities_offering_service('Renew License') + expect(result).to eq([facility_1, facility_3]) +>>>>>>> feature/vehicle-class end end + diff --git a/spec/facility_factory_spec.rb b/spec/facility_factory_spec.rb new file mode 100644 index 000000000..f3ead3233 --- /dev/null +++ b/spec/facility_factory_spec.rb @@ -0,0 +1,22 @@ +require 'rspec' +require './lib/facility_factory' +require './lib/facility' + +RSpec.describe FacilityFactory do + before(:each) do + @factory = FacilityFactory.new + @data = [ + { dmv_office: 'Denver DMV', address_li: '123 Main St', city: 'Denver', phone: '555-1234' }, + { dmv_office: 'Boulder DMV', address_li: '456 Pearl St', city: 'Boulder', phone: '555-5678' } + ] + end + + it 'can create facilities from external data' do + facilities = @factory.create_facilities(@data) + + expect(facilities.length).to eq(2) + expect(facilities.first.name).to eq('Denver DMV') + expect(facilities.first.address).to eq('123 Main St, Denver') + expect(facilities.first.phone).to eq('555-1234') + end +end diff --git a/spec/facility_spec.rb b/spec/facility_spec.rb index c0f2f1233..4d55e11b6 100644 --- a/spec/facility_spec.rb +++ b/spec/facility_spec.rb @@ -1,26 +1,92 @@ -require 'spec_helper' +<<<<<<< HEAD +<<<<<<< HEAD +require 'rspec' # Require RSpec for testing +require './lib/facility' # Require the Facility class file to test +# RSpec test suite for the Facility class +======= +>>>>>>> feature/facility-class +======= +require 'rspec' +require './lib/facility' +require './lib/vehicle' + +>>>>>>> feature/vehicle-class RSpec.describe Facility do before(:each) do - @facility = Facility.new({name: 'DMV Tremont Branch', address: '2855 Tremont Place Suite 118 Denver CO 80205', phone: '(720) 865-4600'}) +<<<<<<< HEAD +<<<<<<< HEAD + # Initialize a facility with a hash of details + @facility = Facility.new({ + name: 'DMV Main Branch', + address: '123 Main St', + phone: '555-1234' +======= + @facility = Facility.new({ + name: 'DMV Main Branch', + address: '123 Main St', + phone: '555-1234' + }) + + @vehicle = Vehicle.new({ + vin: '123456789ABCDEFG', + year: 2000, + make: 'Toyota', + model: 'Camry', + engine: :ice +>>>>>>> feature/vehicle-class + }) + end + + it 'initializes with details and no services' do + expect(@facility.name).to eq('DMV Main Branch') + expect(@facility.address).to eq('123 Main St') + expect(@facility.phone).to eq('555-1234') + expect(@facility.services).to eq([]) + expect(@facility.registered_vehicles).to eq([]) + expect(@facility.collected_fees).to eq(0) + end + + it 'can add services' do + @facility.add_service('Vehicle Registration') + expect(@facility.services).to include('Vehicle Registration') +<<<<<<< HEAD + expect(@facility.services).to include('Renew License') + expect(@facility.services.length).to eq(2) # Check the count of services +======= + # Update to pass a hash for initialization + @facility = Facility.new({ + name: 'DMV Main Branch', + address: '123 Main St', + phone: '555-1234' + }) end - describe '#initialize' do - it 'can initialize' do - expect(@facility).to be_an_instance_of(Facility) - expect(@facility.name).to eq('DMV Tremont Branch') - expect(@facility.address).to eq('2855 Tremont Place Suite 118 Denver CO 80205') - expect(@facility.phone).to eq('(720) 865-4600') - expect(@facility.services).to eq([]) - end + + it 'can initialize with attributes' do + expect(@facility.name).to eq('DMV Main Branch') + expect(@facility.address).to eq('123 Main St') + expect(@facility.phone).to eq('555-1234') + expect(@facility.services).to eq([]) + end + + it 'can add services' do + @facility.add_service('Vehicle Registration') + @facility.add_service('Road Test') + + expect(@facility.services).to include('Vehicle Registration', 'Road Test') +>>>>>>> feature/facility-class +======= end - describe '#add service' do - it 'can add available services' do - expect(@facility.services).to eq([]) - @facility.add_service('New Drivers License') - @facility.add_service('Renew Drivers License') - @facility.add_service('Vehicle Registration') - expect(@facility.services).to eq(['New Drivers License', 'Renew Drivers License', 'Vehicle Registration']) - end + it 'can register a vehicle and collect fees' do + @facility.add_service('Vehicle Registration') + @facility.register_vehicle(@vehicle) + + expect(@facility.registered_vehicles).to include(@vehicle) + expect(@vehicle.registration_date).to be_a(Date) + expect(@vehicle.plate_type).to eq(:regular) + expect(@facility.collected_fees).to eq(100) +>>>>>>> feature/vehicle-class end end + diff --git a/spec/registrant_spec.rb b/spec/registrant_spec.rb new file mode 100644 index 000000000..3c7b0c81d --- /dev/null +++ b/spec/registrant_spec.rb @@ -0,0 +1,24 @@ +require 'rspec' +require './lib/registrant' + +RSpec.describe Registrant do + before(:each) do + @registrant = Registrant.new('Bruce', 18, true) + end + + it 'can initialize with attributes' do + expect(@registrant.name).to eq('Bruce') + expect(@registrant.age).to eq(18) + expect(@registrant.permit?).to eq(true) + expect(@registrant.license_data).to eq({ written: false, license: false, renewed: false }) + end + + it 'can earn a permit' do + registrant = Registrant.new('Penny', 15) + + expect(registrant.permit?).to eq(false) + + registrant.earn_permit + expect(registrant.permit?).to eq(true) + end +end diff --git a/spec/vehicle_factory_spec.rb b/spec/vehicle_factory_spec.rb new file mode 100644 index 000000000..64165be53 --- /dev/null +++ b/spec/vehicle_factory_spec.rb @@ -0,0 +1,24 @@ +require 'rspec' +require './lib/vehicle_factory' +require './lib/vehicle' + +RSpec.describe VehicleFactory do + before(:each) do + @factory = VehicleFactory.new + @data = [ + { vin_1_10: '123ABC4567', model_year: '2012', make: 'Toyota', model: 'Prius' }, + { vin_1_10: '456DEF7890', model_year: '2019', make: 'Tesla', model: 'Model S' } + ] + end + + it 'can create vehicles from external data' do + vehicles = @factory.create_vehicles(@data) + + expect(vehicles.length).to eq(2) + expect(vehicles.first).to be_a(Vehicle) + expect(vehicles.first.vin).to eq('123ABC4567') + expect(vehicles.first.make).to eq('Toyota') + expect(vehicles.first.model).to eq('Prius') + expect(vehicles.first.engine).to eq(:ev) + end +end diff --git a/spec/vehicle_spec.rb b/spec/vehicle_spec.rb index 5c7f01184..9c7ad445d 100644 --- a/spec/vehicle_spec.rb +++ b/spec/vehicle_spec.rb @@ -1,31 +1,78 @@ -require 'spec_helper' +<<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> feature/vehicle-class +require 'rspec' +require './lib/vehicle' RSpec.describe Vehicle do before(:each) do - @cruz = Vehicle.new({vin: '123456789abcdefgh', year: 2012, make: 'Chevrolet', model: 'Cruz', engine: :ice} ) - @bolt = Vehicle.new({vin: '987654321abcdefgh', year: 2019, make: 'Chevrolet', model: 'Bolt', engine: :ev} ) - @camaro = Vehicle.new({vin: '1a2b3c4d5e6f', year: 1969, make: 'Chevrolet', model: 'Camaro', engine: :ice} ) + @vehicle = Vehicle.new({ + vin: '123456789ABCDEFG', +<<<<<<< HEAD +======= +RSpec.describe Vehicle do + before(:each) do + @vehicle = Vehicle.new({ + vin: '123ABC', +>>>>>>> feature/facility-class +======= +>>>>>>> feature/vehicle-class + year: 2000, + make: 'Toyota', + model: 'Camry', + engine: :ice + }) end - describe '#initialize' do - it 'can initialize' do - expect(@cruz).to be_an_instance_of(Vehicle) - expect(@cruz.vin).to eq('123456789abcdefgh') - expect(@cruz.year).to eq(2012) - expect(@cruz.make).to eq('Chevrolet') - expect(@cruz.model).to eq('Cruz') - expect(@cruz.engine).to eq(:ice) - expect(@cruz.registration_date).to eq(nil) - end + +<<<<<<< HEAD +<<<<<<< HEAD + it 'can initialize with details' do + expect(@vehicle.vin).to eq('123456789ABCDEFG') +======= + it 'can initialize with attributes' do + expect(@vehicle.vin).to eq('123ABC') +>>>>>>> feature/facility-class + expect(@vehicle.year).to eq(2000) + expect(@vehicle.make).to eq('Toyota') + expect(@vehicle.model).to eq('Camry') + expect(@vehicle.registration_date).to eq(nil) end - describe '#antique?' do - it 'can determine if a vehicle is an antique' do - expect(@cruz.antique?).to eq(false) - expect(@bolt.antique?).to eq(false) - expect(@camaro.antique?).to eq(true) - end +<<<<<<< HEAD + it 'can register a vehicle and assign plate type' do + @vehicle.register + expect(@vehicle.registration_date).to be_a(Date) + expect(@vehicle.plate_type).to eq(:regular) +======= + it 'can register a vehicle' do + @vehicle.register + expect(@vehicle.registration_date).to eq(Date.today) +>>>>>>> feature/facility-class +======= + it 'initializes with attributes' do + expect(@vehicle.vin).to eq('123456789ABCDEFG') + expect(@vehicle.year).to eq(2000) + expect(@vehicle.make).to eq('Toyota') + expect(@vehicle.model).to eq('Camry') + expect(@vehicle.engine).to eq(:ice) + expect(@vehicle.registration_date).to be_nil + expect(@vehicle.plate_type).to be_nil end + it 'can register and assign a plate type' do + @vehicle.register + expect(@vehicle.registration_date).to be_a(Date) + expect(@vehicle.plate_type).to eq(:regular) + end + + it 'can determine if vehicle is antique' do + expect(@vehicle.antique?).to eq(true) +>>>>>>> feature/vehicle-class + end +end + + describe '#electric_vehicle?' do it 'can determine if a vehicle is an ev' do expect(@cruz.electric_vehicle?).to eq(false)