#rspec errors of expections can from from where its defined or 
class User #constant means class
    attr_reader :username, :tweets #how to return the value of the username attribute. Considered to be a symbol, access tweets
    def initialize(attributes = {}) #takes a hash of att including a username as an arg
        @username = attributes[:username] #how to assign a new instance in classes / keys are always symbols
        @tweets = [] #storing the user tweet here
    end

    def post_tweet(message)
        Tweet.new(message: message, user: self)
    end
end


class Tweet 
    @@all = []

    def self.all
        @@all # ref the class instance of all, add new tweet to a class variable called @@all
    end

    attr_reader :message, :user # getter method that returns the @ message of an instance variable / shorthand
    #def message @message  #end

    def initialize(attributes = {})
        @message = attributes[:message]
        @user = attributes[:user] # how to we access the tweets of a user
        @user.tweets << self
        @@all << self #self is a ref to the tweet being built
    end
       # @@all = [] #bc the class exist before we created an instance of it we can call set this here but best practice to be up top

    def username #we want a tweet that belongs to a particular user, instance method
        @user.username #instance varibale , circa at @user = attributes[:user]
    end

    def delete 
        Tweet.all.delete(self)  
        user.tweets.delete(self) 
      end

end




#Questions:
# Curly braces in line 16 and 21
