Commit Graph

74 Commits

Author SHA1 Message Date
Guo Xiang Tan
a4aa4a9be4 DEV: Remove the use of mocks in our tests. 2018-10-15 10:38:02 +08:00
Sam
eacb2593ee workaround badly denormalized data in polls 2018-08-17 11:15:29 +10:00
Joffrey JAFFEUX
10a3499d68
uses emoji versions for specs (#6276) 2018-08-16 13:45:30 +02:00
Guo Xiang Tan
3a8f69c3d2 DEV: Assert for 200 response code to avoid changing magic helper in the future. 2018-06-07 16:11:09 +08:00
Sam
e806e6e96f correct specs 2018-06-07 16:13:15 +10:00
Régis Hanol
94163d7f1a add spec for auto-close polls 2018-05-07 11:31:20 +02:00
Régis Hanol
9ff2d540ba fix the build 2018-05-03 10:32:01 +02:00
Guo Xiang Tan
51657d3426 Allow polls to be added/renamed/removed as long as user can edit posts. 2018-03-14 11:00:57 +08:00
Guo Xiang Tan
b77553a635 FIX: Staff should be able to updates polls when edit window expires.
https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/7?u=tgxworld
2018-03-08 16:45:06 +08:00
Gerhard Schlager
7a2183e8ab FEATURE: rake task for merging users 2018-03-01 12:28:12 +01:00
Régis Hanol
dee35b72f2 FIX: must be able to post in a topic in order to vote on a poll 2018-02-27 00:19:44 +01:00
Sam
94b2c70c0d PERF: remove oga gem
oga gem is automatically required by the aws gem
the oga gem retains about 1mb of memory, aws now uses nokogiri

This also removes the html normalize from the pretty text specs that was
a fair bit buggy as the polls test shows.
2018-02-15 14:36:40 +11:00
Sam
7e3543d96f correct plugin specs 2018-01-12 14:42:05 +11:00
Joffrey JAFFEUX
316d814130
FIX: staff should always be allowed to create polls if they are enabled 2017-12-05 00:03:56 +01:00
Joffrey JAFFEUX
76bc173d47
FEATURE: adds poll_allow_staff_to_create
This setting will bypass poll_minimum_trust_level_to_create if set to true
2017-12-04 18:12:17 +01:00
Joffrey JAFFEUX
1e0bfa1d97
FIX: poll new_post_manager spec 2017-12-04 16:12:40 +01:00
Joffrey JAFFEUX
63bab32816 FEATURE: introduces minimum trust level for polls (#5391)
* FEATURE: introduces minimum trust level for polls

This commit makes `poll_enabled` less misleading and introduces `poll_minimum_trust_level_to_create`. If poll are enabled they will always be cooked, and if you have the required trust level you can create polls. As a side effect, it also fixes a bug where rebaking a post created by staff member when `poll_enabled=false` would end up not cooking it.

It also adds more tests to ensure settings are respected.

* admins should be whitelisted

* checks for admin in post validation

* test for >= instead of == trust level
2017-12-04 14:47:11 +01:00
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Sam
43c0111ca1 FIX: multichoice poll with more than 25 votes
In the past we would double up on avatars due to incorrect logic for
handling offset
2017-08-14 15:33:59 -04:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Sam
8317fb12e0 FIX: don't escape html of poll options 2017-07-25 13:38:19 -04:00
Sam Saffron
045a2abcec FEATURE: remove the timecop gem
We should only have one way of mocking time, misuse of timecop
was causing build stability issues
2017-07-24 12:11:10 -04:00
Sam
b7f58fe880 regression polls could not be closed properly 2017-07-18 14:52:58 -04:00
Sam
93e5112dfa correct poll specs 2017-07-18 14:31:22 -04:00
Sam
1661a8745b correct issues with poll specs
fixes regression where an error message is missing from a poll
with one option
2017-07-17 17:44:48 -04:00
Guo Xiang Tan
e80a1dfa43 FIX: Post with multiple polls containing votes can not be edited.
https://meta.discourse.org/t/500-internal-server-error-when-editing-specific-poll-in-a-post-with-votes-editing-other-polls-works-fine/59684
2017-07-14 12:33:22 +09:00
Sam
5d139e461c FIX: multi option poll not working (new engine) 2017-07-11 14:43:34 -04:00
Sam
6200d7d6ab correct bug where only a single poll per topic worked 2017-06-28 15:36:19 -04:00
Guo Xiang Tan
a10689de94 Fix broken specs due to new default emoji set. 2017-06-27 10:13:21 +09:00
Sam
234694b50f Feature: CommonMark support
This adds the markdown.it engine to Discourse.
https://github.com/markdown-it/markdown-it

As the migration is going to take a while the new engine is default
disabled. To enable it you must change the hidden site setting:
enable_experimental_markdown_it.

This commit is a squash of many other commits, it also includes some
improvements to autospec (ability to run plugins), and a dev dependency
on the og gem for html normalization.
2017-06-23 12:01:33 -04:00
Guo Xiang Tan
112ca20c96 Merge pull request #4675 from tgxworld/fix_polls_forever_broken_if_approval_required
FIX: Polls permanently broken if post requires approval.
2017-03-01 12:56:03 +08:00
Guo Xiang Tan
8bd8f07ce0 FIX: Public polls should not make a request per option. 2017-01-31 17:27:43 +08:00
Guo Xiang Tan
bed11dfa0e FIX: Polls permanently broken if post requires approval. 2017-01-26 13:29:43 +08:00
Guo Xiang Tan
8c4dfdfa40 FIX: Votes lost when editing a poll option with votes. 2017-01-16 22:51:57 +08:00
Guo Xiang Tan
8213da20f2 Extract polls edit window to a site settings. 2016-08-10 15:17:16 +08:00
Guo Xiang Tan
ffbfcd7ee2 Fix build. 2016-07-29 14:47:23 +08:00
Guo Xiang Tan
a36203ff78
PERF: Paginate public polls. 2016-06-12 16:14:53 +08:00
Guo Xiang Tan
f53494f102 FIX: Polls with votes cannot be made public. 2016-06-09 12:10:27 +08:00
Guo Xiang Tan
8ecde35df3
FEATURE: Add public type to polls. 2016-06-08 16:19:13 +08:00
Guo Xiang Tan
2f14a81fa4
FIX: min setting should be greater than 0 for multiple type polls. 2016-06-07 10:48:06 +08:00
Guo Xiang Tan
a849fae5ee Add specs for polls (#4246)
* Extract validation logic into a service object.

* Extract logic for updating polls custom fields into a service object.

* Use `strip_heredoc` instead.

* FIX: Polls do not update when configuration has been changed.
2016-06-06 17:04:56 +02:00
Gerhard Schlager
f1bc7de541
Adds support for anonymous votes to the poll plugin 2016-04-23 22:44:09 +02:00
Régis Hanol
b575f97ece FIX: allows polls on closed topics 2016-03-21 12:12:25 +01:00
Andy Waite
3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Gerhard Schlager
bb52042b46 FIX: Add missing pluralization keys to poll plugin locale 2015-09-27 21:36:57 +02:00
Régis Hanol
2e76c9165a FIX: polls are always editable until the first vote 2015-09-25 18:54:15 +02:00
Régis Hanol
60bbd81607 FIX: polls with votes were preventing users from updating the post 2015-09-14 19:27:54 +02:00
Sam
d16de4a0a1 correct polls spec 2015-08-05 12:39:38 +10:00
Régis Hanol
c240a8bd80 FIX: make sure we can't vote on deleted polls 2015-06-01 22:31:47 +02:00
Régis Hanol
f736b6face FIX: validate poll parameters when type=multiple 2015-06-01 19:28:05 +02:00