help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
ruby-calculator
/
db
/
migrate
RSK World
ruby-calculator
Ruby Calculator Pro - Interactive Calculator with 8 Types + Mathematical Functions + Rails MVC + Modern Web Interface + API Integration + Educational Design
migrate
  • 001_create_calculation_histories.rb719 B
  • 002_create_favorite_calculations.rb915 B
calculation_history_test.rb
test/models/calculation_history_test.rb
Raw Download
Find: Go to:
# Ruby Calculator - Interactive calculator built with Ruby on Rails
# Author: RSK World (Molla Samser, Founder | Rima Khatun, Designer & Tester)
# Contact: help@rskworld.in | +91 93305 39277
# Website: https://rskworld.in
# Year: 2026
# Description: Build a fully functional calculator using Ruby on Rails with modern UI

require "test_helper"

class CalculationHistoryTest < ActiveSupport::TestCase
  def setup
    @calculation = CalculationHistory.new(
      expression: "5 + 3",
      result: 8,
      operation: "add"
    )
  end

  test "should be valid" do
    assert @calculation.valid?
  end

  test "expression should be present" do
    @calculation.expression = ""
    assert_not @calculation.valid?
  end

  test "result should be present" do
    @calculation.result = nil
    assert_not @calculation.valid?
  end

  test "operation should be present" do
    @calculation.operation = ""
    assert_not @calculation.valid?
  end

  test "should return recent calculations" do
    @calculation.save
    recent = CalculationHistory.recent
    assert_includes recent, @calculation
  end

  test "should filter by operation" do
    @calculation.save
    add_operations = CalculationHistory.by_operation('add')
    assert_includes add_operations, @calculation
  end

  test "should count total calculations" do
    @calculation.save
    assert_equal 1, CalculationHistory.total_calculations
  end

  test "should provide operation stats" do
    @calculation.save
    stats = CalculationHistory.operation_stats
    assert_equal 1, stats['add']
  end
end
61 lines•1.6 KB
ruby

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer