-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'test_helper' | ||
|
||
class ReppV1StatsMarketShareTest < ActionDispatch::IntegrationTest | ||
def setup | ||
@user = users(:api_bestnames) | ||
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}") | ||
token = "Basic #{token}" | ||
|
||
@auth_headers = { 'Authorization' => token } | ||
end | ||
|
||
def test_shows_market_share_data | ||
get '/repp/v1/stats/market_share', headers: @auth_headers | ||
json = JSON.parse(response.body, symbolize_names: true) | ||
|
||
assert_response :ok | ||
assert_equal 1000, json[:code] | ||
assert_equal 'Command completed successfully', json[:message] | ||
|
||
assert json[:data].is_a? Array | ||
assert json[:data][0].is_a? Hash | ||
assert_equal json[:data][0][:name], 'Best Names' | ||
assert json[:data][0][:selected] | ||
end | ||
end |