Sha256: dadcaf8ba08df9cb51d7e6630eb2818ef698cff2ce398e401f1f1686e9a117b1
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
require 'spec_helper' require 'ruby-debug' require 'inkling_api_test_config' describe InklingApi do let(:url) {InklingApiTestConfig.url} let(:login) {InklingApiTestConfig.login} let(:password) {InklingApiTestConfig.password} let(:inkling_api) do InklingApi.url = url InklingApi.login = login InklingApi.password = password InklingApi end %w( configure connection get post put delete markets market new_market update_market delete_market publish_market).each do |meth| it "should respond to #{meth}" do inkling_api.should respond_to(meth.to_sym) end end it "should not raise error on getting a connection" do lambda{ inkling_api.connection }.should_not raise_error end it "should get a list of markets" do inkling_api.markets.should be_an(Array) end # NOTE: This will only work if the markets aren't empty it "should get a market" do markets = inkling_api.markets inkling_api.market(markets.first["id"]).should be_a(Hash) end it "should create a market" do question = "Is this test going to pass?" class_type = "Exclusive" ends_at = "2014-05-05T02:20:30-05:00" tag_list = "tests" inkling_api.new_market(question, class_type, ends_at, tag_list)["market"]["id"].should_not be_nil end it "should update a market" do market_id = 37810 question = "Testing predicition widget" # FIXME: This will raise a <Faraday::Error::ParsingError> because it expects XML to be returned # However, Inkling Markets returns nothing when updating existing markets # inkling_api.update_market(market_id, question).should be_a(String) end it "should delete a market" do market_id = 38271 lambda do inkling_api.delete_market(market_id) end.should_not raise_error end it "should publish a market" do market_id = 38370 lambda do inkling_api.publish_market(market_id) end.should_not raise_error end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inkling_api-0.0.3 | spec/inkling_api_spec.rb |