spec/unit/post_spec.rb in ayadn-1.7.7 vs spec/unit/post_spec.rb in ayadn-1.8.0

- old
+ new

@@ -34,27 +34,33 @@ username: 'test', handle: '@test' }, post_max_length: 256, message_max_length: 2048, - version: 'wee' + version: 'wee', + ruby: '0', + locale: 'gibberish', + platform: 'shoes' }) Ayadn::Settings.stub(:user_token).and_return('XYZ') Ayadn::Settings.stub(:check_for_accounts) Ayadn::Errors.stub(:warn).and_return("warned") Ayadn::Logs.stub(:rec).and_return("logged") end let(:post) { Ayadn::Post.new } #let(:rest) {Ayadn::CNX = double} #verbose in RSpec output, but useful - let(:rest) {Ayadn::CNX} + let(:rest) {Ayadn::CNX} describe "#post" do before do rest.stub(:post).and_return(File.read("spec/mock/posted.json")) end it "posts a post" do - expect(rest).to receive(:post).with("https://api.app.net/posts/?include_annotations=1&access_token=XYZ", {"text"=>"YOLO", "entities"=>{"parse_markdown_links"=>true, "parse_links"=>true}, "annotations"=>[{"type"=>"com.ayadn.user", "value"=>{"+net.app.core.user"=>{"user_id"=>"@test", "format"=>"basic"}}}, {"type"=>"com.ayadn.client", "value"=>{"url"=>"http://ayadn-app.net", "author"=>{"name"=>"Eric Dejonckheere", "username"=>"ericd", "id"=>"69904", "email"=>"eric@aya.io"}, "version"=>"wee"}}]}) + expect(rest).to receive(:post).with("https://api.app.net/posts/?include_annotations=1&access_token=XYZ", {"text"=>"YOLO", "entities"=>{"parse_markdown_links"=>true, "parse_links"=>true}, "annotations"=>[{"type"=>"com.ayadn.user", "value"=>{"+net.app.core.user"=>{"user_id"=>"@test", "format"=>"basic"}, "env"=>{"platform"=>"shoes", "ruby"=>"0", "locale"=>"gibberish"}}}, {"type"=>"com.ayadn.client", "value"=>{"url"=>"http://ayadn-app.net", "author"=>{"name"=>"Eric Dejonckheere", "username"=>"ericd", "id"=>"69904", "email"=>"eric@aya.io"}, "version"=>"wee"}}]}) + x = post.post({text: 'YOLO'}) + end + it "posts a post" do x = post.post({text: 'YOLO'}) end it "returns the posted post" do x = post.post({text: 'whatever'}) expect(x['data']['text']).to eq 'TEST'