File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
require "rest_client"
2
2
require "uri"
3
3
require "json"
4
+ # TODO: remove
5
+ require "webmock"
4
6
5
7
class ToolsController < ApplicationController
6
8
include Tooling
9
+ # TODO: remove
10
+ include WebMock ::API
7
11
8
12
before_action :set_user
9
13
before_action :set_action_page
@@ -127,6 +131,25 @@ def email
127
131
# This endpoint is hit by the js for state legislator lookup-by-address actions.
128
132
# It renders json containing html markup for presentation on the view
129
133
def state_reps
134
+ # TODO: remove
135
+ WebMock . enable!
136
+ WebMock . disable_net_connect! ( allow_localhost : true )
137
+
138
+ mock_data = {
139
+ "officials" => [ {
140
+ "name" => "Sponge Bob" ,
141
+ "party" => "Sandy Party" ,
142
+
143
+ } ]
144
+ }
145
+
146
+ Rails . application . config . google_civic_api_url = "https://civic.example.com"
147
+ Rails . application . secrets . google_civic_api_key = "test-key-for-civic-api"
148
+
149
+ stub_request ( :get , "https://civic.example.com/?address=815%20Eddy%20St%2094109&includeOffices=true&key=test-key-for-civic-api&levels=administrativeArea1&roles=legislatorLowerBody" )
150
+ . to_return ( status : 200 , body : mock_data . to_json , headers : { } )
151
+
152
+ # end remove
130
153
@email_campaign = EmailCampaign . find ( params [ :email_campaign_id ] )
131
154
@actionPage = @email_campaign . action_page
132
155
# TODO: strong params this
You can’t perform that action at this time.
0 commit comments