Default port for running the discourse_api tests


(Blake Erickson) #1

I’m starting to work on the discourse_api gem. There are several features I’d like to implement but I would like to implement the missing tests first. Looks like there is a lot of tests missing in user.rb.

The tests all reference http://localhost/ with no port number but my local discourse is running in vagrant on port 4000. Should I start discourse on port 80 or should we add a port number to the tests? What are other people doing?


(Sam Saffron) #2

I think the default really should be whatever port rails s starts with (I think it defaults to thin and uses 3000)

Regardless it should be configurable using an environment var.


(Blake Erickson) #3

I think making it the default port 3000 makes the most sense and is what I was expecting to see when I first looked at the tests.

I can work on a pull request tomorrow to make the default port be 3000 and configurable with an environment variable. Would that be okay?


(Sam Saffron) #4

Sure, that is fine, also with your prev PR lets get some tests in :slight_smile:


(Blake Erickson) #5

I definitely can add some tests :smiley:


(Blake Erickson) #6

I set the default port to 3000 so that the tests would pass with discourse running with rails s out of the box.

https://github.com/discourse/discourse_api/commit/50483a22e4b6765a135b4201319d66f939b954a1

I’m going to work on making it configurable so that you can specify port 4000 if you are running discourse in vagrant but still want to run the tests against an actual discourse install.


(Blake Erickson) #7

Finally got around to writing the tests to the pull request you were referring to:

https://github.com/discourse/discourse_api/pull/38

Thanks for merging :smiley: