Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is cars.rb:
- class CarImport
- attr_reader :car_type
- def initialize (type)
- @car_type = type
- end
- end
- This is tests.rb:
- require 'test/unit'
- require_relative 'asserts'
- class TestAsserts < Test::Unit::TestCase
- def test_initialize
- car1 = CarImport.new("Toyota")
- assert_equal "Toyota", car1.initialize
- end
- end
- However I get the following error when I run ruby tests.rb:
- `NoMethodError: private method `initialize' called for #<CarImport:0x00000000cbb1a0 @car_type="Toyota">
- `
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement