Class: Decidim::BulletinBoard::Test::ResetTestDatabase

Inherits:
Command
  • Object
show all
Defined in:
lib/decidim/bulletin_board/test/reset_test_database.rb

Overview

This command uses the GraphQL client to clear the database in test mode.

Instance Attribute Summary

Attributes inherited from Command

#graphql, #settings

Instance Method Summary collapse

Methods inherited from Command

#build_message_id, #complete_message, #configure, #sign_message, #unique_election_id

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid and the mutation operation is successful.

  • :error if query operation was not successful.

Returns nothing.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/decidim/bulletin_board/test/reset_test_database.rb', line 14

def call
  graphql.query do
    mutation do
      resetTestDatabase do
        timestamp
      end
    end
  end

  broadcast(:ok)
rescue Graphlient::Errors::ServerError
  broadcast(:error, "Sorry, something went wrong")
end