2

I have a really basic class Seat that looks like this:

class Seat
  constructor: (params) ->
    @x = params.x
    @y = params.y
    @seat_number = params.seat_number
    @table_number = params.table_number
    @radius = params.radius if radius?
    @id = params.id if id?
    @price = params.price if price?

When I try to include it in the seat_spec.js.coffee file with this line:

#= require 'seating_chart/Seat'

and then run the specs I get the error that the Seat object doesn't exist when I try to call new Seat.

I noticed that the CoffeeScript output wraps the declaration of the Seat object inside an anonymous function, and then wraps that function inside another anonymous function, so I understand why I don't have access to the Seat variable - it's never getting assigned to anything, but how do I fix it so that I can call new Seat?

ThomYorkkke
  • 2,061
  • 3
  • 18
  • 26

0 Answers0