spec/unit/annotations_spec.rb in ayadn-3.0 vs spec/unit/annotations_spec.rb in ayadn-4.0

- old
+ new

@@ -4,44 +4,54 @@ describe Ayadn::Annotations do before do Ayadn::Settings.stub(:options).and_return( + Ayadn::Preferences.new( { timeline: { - directed: 1, - html: 0, + directed: true, source: true, symbols: true, name: true, date: true, - spinner: true, - debug: false + debug: false, + compact: false }, + marker: { + messages: true + }, counts: { default: 50, - unified: 100, - global: 100, - checkins: 100, + unified: 50, + global: 50, + checkins: 50, conversations: 50, photos: 50, - trending: 100, - mentions: 100, - convo: 100, - posts: 100, - messages: 50, + trending: 50, + mentions: 50, + convo: 50, + posts: 50, + messages: 20, search: 200, - whoreposted: 50, - whostarred: 50, + whoreposted: 20, + whostarred: 20, whatstarred: 100, - files: 100 + files: 50 }, formats: { table: { - width: 75 + width: 75, + borders: true + }, + list: { + reverse: true } }, + channels: { + links: true + }, colors: { id: :blue, index: :red, username: :green, name: :magenta, @@ -50,47 +60,64 @@ dots: :blue, hashtags: :cyan, mentions: :red, source: :cyan, symbols: :green, + unread: :cyan, debug: :red, excerpt: :green }, backup: { posts: false, messages: false, lists: false }, scroll: { - timer: 3 + spinner: true, + timer: 3, + date: false }, nicerank: { threshold: 2.1, filter: true, unranked: false }, nowplaying: {}, - movie: { - hashtag: 'nowwatching' - }, - tvshow: { - hashtag: 'nowwatching' + blacklist: { + active: true } - } + }) ) - Ayadn::Settings.stub(:config).and_return({ + require 'json' + require 'ostruct' + obj = + { identity: { username: 'test', handle: '@test' }, post_max_length: 256, message_max_length: 2048, version: 'wee', + paths: { + db: 'spec/mock/', + log: 'spec/mock' + }, + platform: 'shoes', ruby: '0', - locale: 'gibberish', - platform: 'shoes' - }) + locale: 'gibberish' + } + Ayadn::Settings.stub(:config).and_return( + JSON.parse(obj.to_json, object_class: OpenStruct) + ) + global_hash = { + scrolling: false, + force: false + } + Ayadn::Settings.stub(:global).and_return( + JSON.parse(global_hash.to_json, object_class: OpenStruct) + ) Ayadn::Errors.stub(:warn).and_return("warned") Ayadn::Logs.stub(:rec).and_return("logged") Ayadn::FileOps.stub(:make_paths).and_return(['~/your/path/cat.jpg', '~/your/path/dog.png']) # STUB1 Ayadn::FileOps.stub(:upload_files).and_return([{'data' => {'id' => 3312,'file_token' => '0x3312-YOLO'}},{'data' => {'id' => 5550,'file_token' => '0x5550-WOOT'}}]) end @@ -119,23 +146,9 @@ rest.stub(:download).and_return({'title' => 'yolo'}.to_json) end it "creates vimeo annotations" do ann = Ayadn::Annotations.new({title: 'WUT', source: 'tEsT', options: {vimeo: ['http://yolo'],}}) expect(ann.content).to eq [{"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"=>"https://github.com/ericdke/na", "author"=>{"name"=>"Eric Dejonckheere", "username"=>"ericd", "id"=>"69904", "email"=>"eric@aya.io"}, "version"=>"wee"}}, {"type"=>"net.app.core.oembed", "value"=>{"version"=>"1.0", "type"=>"video", "provider_name"=>"Vimeo", "provider_url"=>"http://vimeo.com/", "width"=>nil, "height"=>nil, "title"=>"yolo", "author_name"=>nil, "author_url"=>nil, "embeddable_url"=>"http://yolo", "html"=>nil, "thumbnail_url"=>nil, "thumbnail_height"=>nil, "thumbnail_width"=>nil}}, {"type"=>"com.ayadn.vimeo", "value"=>{"title"=>"yolo", "link"=>"http://yolo"}}] - end - end - - describe "#movie" do - it "creates movie annotations" do - ann = Ayadn::Annotations.new({title: 'WUT', source: 'tEsT', options: {movie: true}}) - expect(ann.content).to eq [{"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"=>"https://github.com/ericdke/na", "author"=>{"name"=>"Eric Dejonckheere", "username"=>"ericd", "id"=>"69904", "email"=>"eric@aya.io"}, "version"=>"wee"}}, {"type"=>"com.ayadn.movie", "value"=>{"title"=>"WUT", "source"=>"tEsT"}}] - end - end - - describe "#tvshow" do - it "creates tvshow annotations" do - ann = Ayadn::Annotations.new({title: 'WUT', source: 'tEsT', options: {tvshow: true}}) - expect(ann.content).to eq [{"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"=>"https://github.com/ericdke/na", "author"=>{"name"=>"Eric Dejonckheere", "username"=>"ericd", "id"=>"69904", "email"=>"eric@aya.io"}, "version"=>"wee"}}, {"type"=>"com.ayadn.tvshow", "value"=>{"title"=>"WUT", "source"=>"tEsT"}}] end end describe "#nowplaying --silent" do it "creates nowplaying --silent annotations" do