spec/unit/support/webmocks.rb in trollolo-0.1.1 vs spec/unit/support/webmocks.rb in trollolo-0.2.0

- old
+ new

@@ -5,31 +5,40 @@ file: 'board.json' }, { path: 'boards/53186e8391ef8671265eba9d/lists', parameters: { - "filter" => "open" + 'filter' => 'open' }, file: 'lists.json' }, { path: 'boards/53186e8391ef8671265eba9d', parameters: { - "cards" => "open", - "lists" => "open", - "card_checklists" => "all" + 'cards' => 'open', + 'lists' => 'open', + 'card_checklists' => 'all' }, file: 'full-board.json' }, { path: 'boards/P4kJA4bE', parameters: { - "cards" => "open", - "lists" => "open", - "card_checklists" => "all" + 'cards' => 'open', + 'lists' => 'open', + 'card_checklists' => 'all' }, file: 'full-board-with-accepted.json' + }, + { + path: 'boards/7Zar7bNm', + parameters: { + 'cards' => 'open', + 'lists' => 'open', + 'card_checklists' => 'all' + }, + file: 'full-board.json' } ] end def parameters_as_string(mapping, parameters = nil) @@ -38,24 +47,24 @@ mapping[:parameters].each do |key, value| parameters.push("#{key}=#{value}") end end if !parameters.empty? - parameters_string = "?" + parameters.join("&") + parameters_string = '?' + parameters.join('&') else - parameters_string = "" + parameters_string = '' end parameters_string end def mapping_url(mapping, parameters = nil) - url = "https://api.trello.com/1/" + mapping[:path] + url = 'https://api.trello.com/1/' + mapping[:path] url += parameters_as_string(mapping, parameters) end def full_board_mock webmock_mapping.each do |mapping| - url = mapping_url(mapping, [ "key=mykey", "token=mytoken" ]) + url = mapping_url(mapping, [ 'key=mykey', 'token=mytoken' ]) stub_request(:get, url) - .to_return(:status => 200, :body => load_test_file(mapping[:file])) + .to_return(status: 200, body: load_test_file(mapping[:file])) end end