Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 1.77 KB

File metadata and controls

65 lines (50 loc) · 1.77 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Overview

This is a Ruby implementation of a vending machine kata. The project models a vending machine that can:

  • Accept product selection and money insertion
  • Return correct products and change
  • Track inventory and change denominations
  • Handle reloading of products and change

Workflow

  • Please avoid redundant specs when writing new specs

Core Architecture

The system is built around three main classes:

  • VendingMachine: Main orchestrator that manages items and balance
  • Item: Represents products with name and price
  • Change: Handles monetary denominations (1p, 2p, 5p, 10p, 20p, 50p, €1, €2)

All classes are in lib/ directory and follow Ruby conventions with corresponding specs in spec/lib/.

Development Commands

Running Tests

# Run all tests
bundle exec rspec

# Run specific test file
bundle exec rspec spec/lib/vending_machine_spec.rb

# Run with specific format
bundle exec rspec --format documentation

Code Quality

# Run RuboCop linter
bundle exec rubocop

# Run RuboCop with auto-correct
bundle exec rubocop -a

# Additional quality tools available:
bundle exec reek      # Code smell detection
bundle exec flog      # Complexity analysis
bundle exec fasterer  # Performance suggestions
bundle exec rubycritic # Overall code quality report

Dependencies

# Install dependencies
bundle install

# Update dependencies
bundle update

Project Structure

  • Core logic in lib/ with classes: VendingMachine, Item, Change
  • Specs in spec/lib/ mirroring the lib structure
  • RSpec configured to auto-load all lib files via spec_helper.rb
  • Ruby 3.4.4 with comprehensive linting and code quality tools