Skip to content

Commit

Permalink
chore: adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Jul 16, 2020
1 parent 9776722 commit b38ba86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/controllers/api/v1/contracts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "pry"
module Api
module V1
class ContractsController < ApplicationController
Expand Down
3 changes: 3 additions & 0 deletions test/controllers/api/v1/contracts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ class ContractsControllerTest < ActionDispatch::IntegrationTest
end

test "the returned dao contract when param is dao_contract" do
DaoContract.default_contract
valid_get api_v1_contract_url(DaoContract::CONTRACT_NAME)

assert_equal DaoContract::CONTRACT_NAME, json.dig("data", "type")
end

test "should contain right keys in the serialized object when visit show" do
DaoContract.default_contract
valid_get api_v1_contract_url(DaoContract::CONTRACT_NAME)

response_contract = json["data"]
Expand All @@ -61,6 +63,7 @@ class ContractsControllerTest < ActionDispatch::IntegrationTest
end

test "should return corresponding contract with given contract name" do
DaoContract.default_contract
valid_get api_v1_contract_url(DaoContract::CONTRACT_NAME)

assert_equal JSON.parse(DaoContractSerializer.new(DaoContract.default_contract).serialized_json), json
Expand Down

0 comments on commit b38ba86

Please sign in to comment.