spec/integration/action_spec.rb in ayadn-3.0 vs spec/integration/action_spec.rb in ayadn-4.0

- old
+ new

@@ -9,47 +9,57 @@ end end end describe Ayadn::Action 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, compact: false }, + marker: { + messages: true + }, counts: { - default: 50, - unified: 100, + default: 100, + unified: 33, global: 100, checkins: 100, - conversations: 50, - photos: 50, + conversations: 100, + photos: 100, trending: 100, mentions: 100, convo: 100, posts: 100, - messages: 50, + messages: 20, search: 200, - whoreposted: 50, - whostarred: 50, + whoreposted: 20, + whostarred: 20, whatstarred: 100, files: 100 }, formats: { table: { - width: 75 + width: 75, + borders: true + }, + list: { + reverse: true } }, + channels: { + links: true + }, colors: { id: :blue, index: :red, username: :green, name: :magenta, @@ -58,54 +68,63 @@ 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: false, + filter: true, unranked: false }, nowplaying: {}, - movie: { - hashtag: 'nowwatching' - }, - tvshow: { - hashtag: 'nowwatching' - }, blacklist: { active: true } - }) - Ayadn::Settings.stub(:config).and_return({ - identity: { - username: 'test', - handle: '@test' - }, - post_max_length: 256, - message_max_length: 2048, - version: 'wee', - paths: { - db: 'spec/mock/', - log: 'spec/mock' + })) + 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' } - }) - Ayadn::Settings.stub(:global).and_return({ + 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) + ) Dir.stub(:home).and_return("spec/mock") Ayadn::Settings.stub(:get_token).and_return('XYZ') Ayadn::Settings.stub(:user_token).and_return('XYZ') Ayadn::Settings.stub(:check_for_accounts).and_return([nil, nil, nil, "spec/mock"]) Ayadn::Settings.stub(:config_file) @@ -117,14 +136,16 @@ Ayadn::Databases.stub(:get_post_from_index).and_return(3333333333333) Ayadn::Databases.stub(:is_in_blacklist?).and_return(false) Ayadn::Databases.stub(:has_new?).and_return(true) Ayadn::Databases.stub(:add_to_users_db_from_list) end + let(:stream) { File.read("spec/mock/stream.json") } let(:mentions) { File.read("spec/mock/mentions.json") } let(:list) { File.read("spec/mock/fwr_@ayadn.json") } let(:ranks) { JSON.parse(File.read("spec/mock/nicerank.json")) } let(:cnx) {Ayadn::CNX} + describe "#Global" do before do cnx.stub(:get) cnx.stub(:get_response_from).and_return(stream) Ayadn::NiceRank.stub(:get_ranks).and_return(ranks) \ No newline at end of file