Commit Graph

41 Commits

Author SHA1 Message Date
Javi Martín
3af958bc92 Simplify checking attributes in GraphQL specs
Since we're obtaining titles and usernames in the response, it's easier
to compare them to titles and usernames we manually set.

Furthermore, this way we avoid many useless assignments.
2019-09-30 14:29:15 +02:00
Javi Martín
818b442d52 Simplify creating voters in specs 2019-09-30 00:36:40 +02:00
Javi Martín
ee0031ccb3 Remove isolated data creation useless assignments
While there are other variables in these tests, they're not part of the
setup of the test, and so these ones can be removed while keeping the
code easy to read.
2019-09-25 12:43:44 +02:00
Javi Martín
49f81c9488 Add trait to create users with proposal and debate 2019-09-24 21:34:06 +02:00
Javi Martín
2b2c528098 Use hidden trait in specs
We were using it in most places, but there were a few where we still
used `hidden_at: Time.current`.
2019-09-24 21:34:06 +02:00
Javi Martín
da425b9164 Remove commented graphql code
This code was commented in commit ad8aba07.
2019-09-24 19:27:17 +02:00
Javi Martín
82ea866b6d Remove commented graphql tests
These tests use a "proceeding" method in proposals, which does not
exist.
2019-09-24 19:27:08 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
49751f46ec Fix tests for uppercase tags
The tests in the `spec/lib/graphql_spec.rb` failed sometimes because
creating a record with a tag list of ["health"] when both "health" and
"Health" tags exist might assign either one of them. These tests usually
pass because we create two records and just by chance usually one of the
records gets one tag and the other one gets the other tag. However, the
test was written as if we expected the first record to get the first tag
and the second record to get the second tag, while very often the tests
were passing because the first record got the second tag and the second
record got the first tag. And when both records get the same tag, the
tests fail.

So I've changed these tests to tags are assigned directly and, since we
want to test the `tag_list` method, I've also added some tests to the
Tag model, which reflect the current behaviour: a random tag is assigned
when several tags with the same case-insensitive name exist.

Another option to assign the right tag to the record we're creating
would be to add `ActsAsTaggableOn.strict_case_match = true` to an
initializer. However, that would also create new tags on the database
when we accidentally assign a tag like "hEaLth" (like in the test we add
in this commit). Ideally we would have a strict case match for existing
tags and a non-strict case match for new tags, but I haven't found a way
to do it.
2019-09-07 16:43:41 +02:00
Senén Rodero Rodríguez
5d0b74cb07 Initialize graphql after application initialization
Proposal, Debate and Comment "globalize_accessors" class method were
loaded before application available locales initialization because of
graphql initializer. This will cause unexpected translation errors at
any translatable classes declared at graphql api definition (api.yml).

Doing GraphQL initialization after application initialization should
solve this issue.
2019-06-27 09:19:35 +02:00
voodoorai2000
cb9c3696f4 Use budget investments in useful specs 2019-05-31 18:23:03 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Angel Perez
b3ce674ffc Enable previously disabled test scenarios 2018-03-27 14:47:50 -04:00
Bertocq
fcf5e6223b Ensure graphql doesnt return valuation comments 2018-01-31 18:31:22 +01:00
Bertocq
34bb9d65b1 Enable RSpec/NotToNot cop and fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
2018-01-07 17:39:48 +01:00
Bertocq
6ec6f64675 Enable RSpec/DescribeClass rubocop rspec cop & fix issues
Manually fixes all issues & "stashed" false positives at .rubocop_todo.yml

Read about the cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
2018-01-07 00:20:55 +01:00
rgarcia
56945d9bbe allows querying for a proposal's votes 2017-12-15 19:21:02 +01:00
Juanjo Bazán
21b2a11339 adds poll comments to API 2017-11-21 14:31:03 +01:00
Raimond Garcia
22d28d9c79 Merge branch 'master' into issue#1575-tag-administration 2017-06-29 19:09:54 +02:00
Bertocq
d759aca522 Fix all Rails/TimeZone rubocop issues and remove files from rubocop_todo list 2017-06-25 15:46:46 +02:00
Eduardo Martinez Echevarria
a600dcbb36 Replace category factory in tags with a trait 2017-06-23 17:34:55 +02:00
Alberto Miedes Garcés
d4752491f8 Fix timezones 2017-05-15 20:39:59 +02:00
Alberto Miedes Garcés
ad8aba0739 Revised public fields, wrote more exhaustive specs 2017-05-15 20:22:11 +02:00
Alberto Miedes Garcés
c52602e04b Simplify the way ApiTypesCreator is used 2017-01-27 13:13:19 +01:00
Alberto Miedes Garcés
620c83fb69 Simplify the way QueryTypeCreator is used 2017-01-27 12:54:33 +01:00
Alberto Miedes Garcés
e8fc387574 Add Organization to API 2017-01-26 10:57:02 +01:00
Alberto Miedes Garcés
e7f55b10e2 Remove obsolete specs 2017-01-25 13:58:44 +01:00
Alberto Miedes Garcés
18fb1485eb No need to specify the resolve type for GraphQL::Schema
This was needed back in the 0.18.11 version but not anymore after the
update to 1.3.0
2017-01-16 11:28:28 +01:00
Alberto Miedes Garcés
cb0a477d88 Fix weird bug caused by pending specs 2017-01-16 11:23:48 +01:00
Alberto Miedes Garcés
7a9373942a Testing GraphQL 1.3.0 in Travis 2017-01-12 20:11:47 +01:00
Alberto Miedes Garcés
2741dcf03c Temporary remove organizations from API 2016-12-26 20:45:46 +01:00
Alberto Miedes Garcés
10eedebcb2 Refactor GraphQL specs to use public_author instead of author 2016-12-13 14:26:00 +01:00
Alberto Miedes Garcés
c973195267 Refactor ConsulSchema specs 2016-12-02 21:30:13 +01:00
Alberto Miedes Garcés
aef20aadf7 Refactor specs for TypeCreator and ConsulSchema 2016-11-30 13:44:31 +01:00
Alberto Miedes Garcés
027bdf3f16 DRYed specs 2016-11-23 00:16:01 +01:00
Alberto Miedes Garcés
13273f4bc2 DRYed specs 2016-11-22 23:49:05 +01:00
Alberto Miedes Garcés
7bb1778124 Finished tests for GraphQL queries for single resources 2016-11-18 19:57:07 +01:00
Alberto Miedes Garcés
860704d908 Rewrote tests to tackle more specific stuff 2016-11-18 16:27:15 +01:00
Alberto Miedes Garcés
4e2a003931 Half-made tests for ConsulSchema 2016-11-17 17:54:02 +01:00
Alberto Miedes Garcés
96bfbbf9af Half-made tests for GraphQL::TypeCreator 2016-11-17 17:48:03 +01:00
Alberto Miedes Garcés
b10b701319 Started GraphQL::TypeCreator testing 2016-11-14 16:08:56 +01:00