How do I run only discourse/plugins/poll/spec?


(Loic Dachary) #1

Hi,

I’d like to only run the tests at discourse/plugins/poll/spec instead of the whole suite with bundle exec rake autospec p l=5. How can I do that ?

Ideally that would not be necessary if autospec detected changes made to plugins but my understanding is that it’s not yet able to do so.

Thanks in advance for your help :slight_smile:


(Gerhard Schlager) #2

Not sure how it works with autospec since I’m running the specs manually most of the time.
In order to run the plugin specs I’m always setting an environment variable in my IDE: LOAD_PLUGINS=1


(Loic Dachary) #3

Cool ! How would you manually run the spec of the poll plugin ? My IDE is the CLI :slight_smile:


(Loic Dachary) #4

I tried

bundle exec rake autospec plugins/poll/spec/*

but it shows

Randomized with seed 8681 ……*…

etc. which suggests it runs more than what I’d expect.


(Gerhard Schlager) #5
# this runs just the specs in one file
LOAD_PLUGINS=1 bundle exec rspec plugins/poll/spec/controllers/posts_controller_spec.rb

# this runs all the specs of the poll plugin
LOAD_PLUGINS=1 bundle exec rspec plugins/poll/spec

(Alan Tan) #6

Another way to do it is via the rake task

bundle exec rake plugin:spec["poll"]


Beginner’s Guide to Creating Discourse Plugins Part 6: Acceptance Tests
Unable to run plugin spec
(Loic Dachary) #7

It works, thanks ! Where would be the most relevant topic for this information ? Or maybe there is a file in the git repository that should be updated ? The closest thing I found is the Beginner’s Guide to Creating Discourse Plugins Part 6: Acceptance Tests but it only covers part of the qunit tests.


(Loic Dachary) #8

This does not work for me but

bundle exec rake plugin:spec poll

does.


(Loic Dachary) #9

I proposed a change to the VAGRANT.md file. Not sure it’s right but… here it is anyway :wink: