Browse files

Change sort flag to enum

  • Loading branch information...
1 parent 464cf72 commit 9d9d38cf6d5cfac82d18e83ea004912b8dab34d9 @sferik committed Jul 8, 2012
Showing with 364 additions and 415 deletions.
  1. +2 −0 Gemfile
  2. +8 −53 lib/t/cli.rb
  3. +1 −7 lib/t/list.rb
  4. +30 −26 lib/t/printable.rb
  5. +1 −7 lib/t/search.rb
  6. +258 −258 spec/cli_spec.rb
  7. +32 −32 spec/list_spec.rb
  8. +32 −32 spec/search_spec.rb
View
2 Gemfile
@@ -8,4 +8,6 @@ platforms :mri do
gem 'ruby-prof'
end
+gem 'thor', :github => 'wycats/thor', :branch => 'enum'
+
gemspec
View
61 lib/t/cli.rb
@@ -202,16 +202,10 @@ def direct_messages_sent
desc "groupies [USER]", "Returns the list of people who follow you but you don't follow back."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def groupies(user=nil)
if user
@@ -376,16 +370,10 @@ def follow(user, *users)
desc "followings [USER]", "Returns a list of the people you follow on Twitter."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def followings(user=nil)
if user
@@ -408,16 +396,10 @@ def followings(user=nil)
desc "followers [USER]", "Returns a list of the people who follow you on Twitter."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def followers(user=nil)
if user
@@ -440,16 +422,10 @@ def followers(user=nil)
desc "friends [USER]", "Returns the list of people who you follow and follow you back."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def friends(user=nil)
if user
@@ -480,16 +456,10 @@ def friends(user=nil)
desc "leaders [USER]", "Returns the list of people who you follow but don't follow you back."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def leaders(user=nil)
if user
@@ -522,11 +492,8 @@ def leaders(user=nil)
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "members", :aliases => "-m", :type => :boolean, :default => false, :desc => "Sort by number of members."
- method_option "mode", :aliases => "-o", :type => :boolean, :default => false, :desc => "Sort by mode."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter list was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "subscribers", :aliases => "-s", :type => :boolean, :default => false, :desc => "Sort by number of subscribers."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(members mode posted slug subscribers), :default => "slug", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def lists(user=nil)
if user
@@ -724,17 +691,11 @@ def status(status_id)
desc "suggest [USER]", "Returns a listing of Twitter users' accounts you might enjoy following."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
method_option "number", :aliases => "-n", :type => :numeric, :default => DEFAULT_NUM_RESULTS, :desc => "Limit the number of results."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def suggest(user=nil)
if user
@@ -848,16 +809,10 @@ def update(message)
desc "users USER [USER...]", "Returns a list of users you specify."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify input as Twitter user IDs instead of screen names."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def users(user, *users)
users.unshift(user)
View
8 lib/t/list.rb
@@ -97,16 +97,10 @@ def information(list)
desc "members [USER/]LIST", "Returns the members of a Twitter list."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "followers", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by total number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by total number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by total number of friends."
method_option "id", :aliases => "-i", :type => "boolean", :default => false, :desc => "Specify user via ID instead of screen name."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by total number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def members(list)
owner, list = list.split('/')
View
56 lib/t/printable.rb
@@ -56,16 +56,18 @@ def print_csv_user(user)
end
def print_lists(lists)
- lists = lists.sort_by{|list| list.slug.downcase} unless options['unsorted']
- if options['posted']
- lists = lists.sort_by{|user| user.created_at}
- elsif options['members']
- lists = lists.sort_by{|user| user.member_count}
- elsif options['mode']
- lists = lists.sort_by{|user| user.mode}
- elsif options['subscribers']
- lists = lists.sort_by{|user| user.subscriber_count}
- end
+ lists = case options['sort']
+ when 'members'
+ lists.sort_by{|user| user.member_count}
+ when 'mode'
+ lists.sort_by{|user| user.mode}
+ when 'posted'
+ lists.sort_by{|user| user.created_at}
+ when 'subscribers'
+ lists.sort_by{|user| user.subscriber_count}
+ else
+ lists.sort_by{|list| list.slug.downcase}
+ end unless options['unsorted']
lists.reverse! if options['reverse']
if options['csv']
require 'csv'
@@ -145,22 +147,24 @@ def print_statuses(statuses)
end
def print_users(users)
- users = users.sort_by{|user| user.screen_name.downcase} unless options['unsorted']
- if options['posted']
- users = users.sort_by{|user| user.created_at}
- elsif options['favorites']
- users = users.sort_by{|user| user.favourites_count}
- elsif options['followers']
- users = users.sort_by{|user| user.followers_count}
- elsif options['friends']
- users = users.sort_by{|user| user.friends_count}
- elsif options['listed']
- users = users.sort_by{|user| user.listed_count}
- elsif options['tweets']
- users = users.sort_by{|user| user.statuses_count}
- elsif options['tweeted']
- users = users.sort_by{|user| user.status.created_at rescue Time.at(0)}
- end
+ users = case options['sort']
+ when 'favorites'
+ users.sort_by{|user| user.favourites_count}
+ when 'followers'
+ users.sort_by{|user| user.followers_count}
+ when 'friends'
+ users.sort_by{|user| user.friends_count}
+ when 'listed'
+ users.sort_by{|user| user.listed_count}
+ when 'since'
+ users.sort_by{|user| user.created_at}
+ when 'tweets'
+ users.sort_by{|user| user.statuses_count}
+ when 'tweeted'
+ users.sort_by{|user| user.status.created_at rescue Time.at(0)}
+ else
+ users.sort_by{|user| user.screen_name.downcase}
+ end unless options['unsorted']
users.reverse! if options['reverse']
if options['csv']
require 'csv'
View
8 lib/t/search.rb
@@ -163,15 +163,9 @@ def timeline(*args)
desc "users QUERY", "Returns users that match the specified query."
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
- method_option "favorites", :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
- method_option "followers", :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
- method_option "friends", :aliases => "-e", :type => :boolean, :default => false, :desc => "Sort by number of friends."
- method_option "listed", :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
- method_option "posted", :aliases => "-p", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter account was posted."
method_option "reverse", :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
- method_option "tweets", :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
- method_option "tweeted", :aliases => "-w", :type => :boolean, :default => false, :desc => "Sort by the time of the last Tweet."
+ method_option "sort", :aliases => "-s", :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => "screen_name", :desc => "Specify the order of the results.", :banner => "ORDER"
method_option "unsorted", :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
def users(query)
users = collect_with_page do |page|
View
516 spec/cli_spec.rb
@@ -533,85 +533,85 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
before do
- @cli.options = @cli.options.merge("favorites" => true)
+ @cli.options = @cli.options.merge("long" => true)
end
- it "should sort by number of favorites" do
+ it "should output in long format" do
@cli.groupies
- $stdout.string.chomp.should == "pengwynn sferik"
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
end
end
- context "--followers" do
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("followers" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
end
- it "should sort by number of followers" do
+ it "should reverse the order of the sort" do
@cli.groupies
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=favorites" do
before do
- @cli.options = @cli.options.merge("friends" => true)
+ @cli.options = @cli.options.merge("sort" => "favorites")
end
- it "should sort by number of friends" do
+ it "should sort by number of favorites" do
@cli.groupies
- $stdout.string.chomp.should == "sferik pengwynn"
+ $stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--listed" do
+ context "--sort=followers" do
before do
- @cli.options = @cli.options.merge("listed" => true)
+ @cli.options = @cli.options.merge("sort" => "followers")
end
- it "should sort by number of list memberships" do
+ it "should sort by number of followers" do
@cli.groupies
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
+ context "--sort=friends" do
before do
- @cli.options = @cli.options.merge("long" => true)
+ @cli.options = @cli.options.merge("sort" => "friends")
end
- it "should output in long format" do
+ it "should sort by number of friends" do
@cli.groupies
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
+ $stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--posted" do
+ context "--sort=listed" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("sort" => "listed")
end
- it "should sort by the time when Twitter acount was created" do
+ it "should sort by number of list memberships" do
@cli.groupies
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
+ context "--sort=since" do
before do
- @cli.options = @cli.options.merge("reverse" => true)
+ @cli.options = @cli.options.merge("sort" => "since")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time when Twitter acount was created" do
@cli.groupies
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @cli.options = @cli.options.merge("tweets" => true)
+ @cli.options = @cli.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@cli.groupies
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @cli.options = @cli.options.merge("tweeted" => true)
+ @cli.options = @cli.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@cli.groupies
@@ -1264,85 +1264,85 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
before do
- @cli.options = @cli.options.merge("favorites" => true)
+ @cli.options = @cli.options.merge("long" => true)
end
- it "should sort by number of favorites" do
+ it "should output in long format" do
@cli.followings
- $stdout.string.chomp.should == "pengwynn sferik"
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
end
end
- context "--followers" do
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("followers" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
end
- it "should sort by number of followers" do
+ it "should reverse the order of the sort" do
@cli.followings
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=favorites" do
before do
- @cli.options = @cli.options.merge("friends" => true)
+ @cli.options = @cli.options.merge("sort" => "favorites")
end
- it "should sort by number of friends" do
+ it "should sort by number of favorites" do
@cli.followings
- $stdout.string.chomp.should == "sferik pengwynn"
+ $stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--listed" do
+ context "--sort=followers" do
before do
- @cli.options = @cli.options.merge("listed" => true)
+ @cli.options = @cli.options.merge("sort" => "followers")
end
- it "should sort by number of list memberships" do
+ it "should sort by number of followers" do
@cli.followings
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
+ context "--sort=friends" do
before do
- @cli.options = @cli.options.merge("long" => true)
+ @cli.options = @cli.options.merge("sort" => "friends")
end
- it "should output in long format" do
+ it "should sort by number of friends" do
@cli.followings
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
+ $stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--posted" do
+ context "--sort=listed" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("sort" => "listed")
end
- it "should sort by the time when Twitter acount was created" do
+ it "should sort by number of list memberships" do
@cli.followings
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
+ context "--sort=since" do
before do
- @cli.options = @cli.options.merge("reverse" => true)
+ @cli.options = @cli.options.merge("sort" => "since")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time when Twitter acount was created" do
@cli.followings
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @cli.options = @cli.options.merge("tweets" => true)
+ @cli.options = @cli.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@cli.followings
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @cli.options = @cli.options.merge("tweeted" => true)
+ @cli.options = @cli.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@cli.followings
@@ -1428,85 +1428,85 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
before do
- @cli.options = @cli.options.merge("favorites" => true)
+ @cli.options = @cli.options.merge("long" => true)
end
- it "should sort by number of favorites" do
+ it "should output in long format" do
@cli.followers
- $stdout.string.chomp.should == "pengwynn sferik"
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
end
end
- context "--followers" do
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("followers" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
end
- it "should sort by number of followers" do
+ it "should reverse the order of the sort" do
@cli.followers
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=favorites" do
before do
- @cli.options = @cli.options.merge("friends" => true)
+ @cli.options = @cli.options.merge("sort" => "favorites")
end
- it "should sort by number of friends" do
+ it "should sort by number of favorites" do
@cli.followers
- $stdout.string.chomp.should == "sferik pengwynn"
+ $stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--listed" do
+ context "--sort=followers" do
before do
- @cli.options = @cli.options.merge("listed" => true)
+ @cli.options = @cli.options.merge("sort" => "followers")
end
- it "should sort by number of list memberships" do
+ it "should sort by number of followers" do
@cli.followers
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
+ context "--sort=friends" do
before do
- @cli.options = @cli.options.merge("long" => true)
+ @cli.options = @cli.options.merge("sort" => "friends")
end
- it "should output in long format" do
+ it "should sort by number of friends" do
@cli.followers
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
+ $stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--posted" do
+ context "--sort=listed" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("sort" => "listed")
end
- it "should sort by the time when Twitter acount was created" do
+ it "should sort by number of list memberships" do
@cli.followers
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
+ context "--sort=since" do
before do
- @cli.options = @cli.options.merge("reverse" => true)
+ @cli.options = @cli.options.merge("sort" => "since")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time when Twitter acount was created" do
@cli.followers
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @cli.options = @cli.options.merge("tweets" => true)
+ @cli.options = @cli.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@cli.followers
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @cli.options = @cli.options.merge("tweeted" => true)
+ @cli.options = @cli.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@cli.followers
@@ -1601,85 +1601,85 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
before do
- @cli.options = @cli.options.merge("favorites" => true)
+ @cli.options = @cli.options.merge("long" => true)
end
- it "should sort by number of favorites" do
+ it "should output in long format" do
@cli.friends
- $stdout.string.chomp.should == "pengwynn sferik"
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
end
end
- context "--followers" do
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("followers" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
end
- it "should sort by number of followers" do
+ it "should reverse the order of the sort" do
@cli.friends
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=favorites" do
before do
- @cli.options = @cli.options.merge("friends" => true)
+ @cli.options = @cli.options.merge("sort" => "favorites")
end
- it "should sort by number of friends" do
+ it "should sort by number of favorites" do
@cli.friends
- $stdout.string.chomp.should == "sferik pengwynn"
+ $stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--listed" do
+ context "--sort=followers" do
before do
- @cli.options = @cli.options.merge("listed" => true)
+ @cli.options = @cli.options.merge("sort" => "followers")
end
- it "should sort by number of list memberships" do
+ it "should sort by number of followers" do
@cli.friends
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
+ context "--sort=friends" do
before do
- @cli.options = @cli.options.merge("long" => true)
+ @cli.options = @cli.options.merge("sort" => "friends")
end
- it "should output in long format" do
+ it "should sort by number of friends" do
@cli.friends
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
+ $stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--posted" do
+ context "--sort=listed" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("sort" => "listed")
end
- it "should sort by the time when Twitter acount was created" do
+ it "should sort by number of list memberships" do
@cli.friends
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
+ context "--sort=since" do
before do
- @cli.options = @cli.options.merge("reverse" => true)
+ @cli.options = @cli.options.merge("sort" => "since")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time when Twitter acount was created" do
@cli.friends
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @cli.options = @cli.options.merge("tweets" => true)
+ @cli.options = @cli.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@cli.friends
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @cli.options = @cli.options.merge("tweeted" => true)
+ @cli.options = @cli.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@cli.friends
@@ -1783,85 +1783,85 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
before do
- @cli.options = @cli.options.merge("favorites" => true)
+ @cli.options = @cli.options.merge("long" => true)
end
- it "should sort by number of favorites" do
+ it "should output in long format" do
@cli.leaders
- $stdout.string.chomp.should == "pengwynn sferik"
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
end
end
- context "--followers" do
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("followers" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
end
- it "should sort by number of followers" do
+ it "should reverse the order of the sort" do
@cli.leaders
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=favorites" do
before do
- @cli.options = @cli.options.merge("friends" => true)
+ @cli.options = @cli.options.merge("sort" => "favorites")
end
- it "should sort by number of friends" do
+ it "should sort by number of favorites" do
@cli.leaders
- $stdout.string.chomp.should == "sferik pengwynn"
+ $stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--listed" do
+ context "--sort=followers" do
before do
- @cli.options = @cli.options.merge("listed" => true)
+ @cli.options = @cli.options.merge("sort" => "followers")
end
- it "should sort by number of list memberships" do
+ it "should sort by number of followers" do
@cli.leaders
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
+ context "--sort=friends" do
before do
- @cli.options = @cli.options.merge("long" => true)
+ @cli.options = @cli.options.merge("sort" => "friends")
end
- it "should output in long format" do
+ it "should sort by number of friends" do
@cli.leaders
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
+ $stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--posted" do
+ context "--sort=listed" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("sort" => "listed")
end
- it "should sort by the time when Twitter acount was created" do
+ it "should sort by number of list memberships" do
@cli.leaders
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
+ context "--sort=since" do
before do
- @cli.options = @cli.options.merge("reverse" => true)
+ @cli.options = @cli.options.merge("sort" => "since")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time when Twitter acount was created" do
@cli.leaders
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @cli.options = @cli.options.merge("tweets" => true)
+ @cli.options = @cli.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@cli.leaders
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @cli.options = @cli.options.merge("tweeted" => true)
+ @cli.options = @cli.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@cli.leaders
@@ -1966,45 +1966,45 @@
eos
end
end
- context "--members" do
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("members" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
end
- it "should sort by the time when Twitter acount was created" do
+ it "should reverse the order of the sort" do
@cli.lists
$stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
end
end
- context "--mode" do
+ context "--sort=members" do
before do
- @cli.options = @cli.options.merge("mode" => true)
+ @cli.options = @cli.options.merge("sort" => "members")
end
it "should sort by the time when Twitter acount was created" do
@cli.lists
- $stdout.string.chomp.should == "@sferik/code-for-america @sferik/presidents"
+ $stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
end
end
- context "--posted" do
+ context "--sort=mode" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("sort" => "mode")
end
it "should sort by the time when Twitter acount was created" do
@cli.lists
- $stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
+ $stdout.string.chomp.should == "@sferik/code-for-america @sferik/presidents"
end
end
- context "--reverse" do
+ context "--sort=posted" do
before do
- @cli.options = @cli.options.merge("reverse" => true)
+ @cli.options = @cli.options.merge("sort" => "posted")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time when Twitter acount was created" do
@cli.lists
$stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
end
end
- context "--subscribers" do
+ context "--sort=subscribers" do
before do
- @cli.options = @cli.options.merge("subscribers" => true)
+ @cli.options = @cli.options.merge("sort" => "subscribers")
end
it "should sort by the time when Twitter acount was created" do
@cli.lists
@@ -2882,42 +2882,6 @@
eos
end
end
- context "--favorites" do
- before do
- @cli.options = @cli.options.merge("favorites" => true)
- end
- it "should sort by number of favorites" do
- @cli.suggest
- $stdout.string.chomp.should == "stuntmann82 antpires maccman mlroach jtrupiano"
- end
- end
- context "--followers" do
- before do
- @cli.options = @cli.options.merge("followers" => true)
- end
- it "should sort by number of followers" do
- @cli.suggest
- $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
- end
- end
- context "--friends" do
- before do
- @cli.options = @cli.options.merge("friends" => true)
- end
- it "should sort by number of friends" do
- @cli.suggest
- $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
- end
- end
- context "--listed" do
- before do
- @cli.options = @cli.options.merge("listed" => true)
- end
- it "should sort by number of list memberships" do
- @cli.suggest
- $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
- end
- end
context "--long" do
before do
@cli.options = @cli.options.merge("long" => true)
@@ -2948,36 +2912,72 @@
should have_been_made
end
end
- context "--posted" do
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
end
- it "should sort by the time when Twitter acount was created" do
+ it "should reverse the order of the sort" do
@cli.suggest
- $stdout.string.chomp.should == "maccman mlroach jtrupiano stuntmann82 antpires"
+ $stdout.string.chomp.should == "stuntmann82 mlroach maccman jtrupiano antpires"
end
end
- context "--reverse" do
+ context "--sort=favorites" do
before do
- @cli.options = @cli.options.merge("reverse" => true)
+ @cli.options = @cli.options.merge("sort" => "favorites")
end
- it "should reverse the order of the sort" do
+ it "should sort by number of favorites" do
@cli.suggest
- $stdout.string.chomp.should == "stuntmann82 mlroach maccman jtrupiano antpires"
+ $stdout.string.chomp.should == "stuntmann82 antpires maccman mlroach jtrupiano"
+ end
+ end
+ context "--sort=followers" do
+ before do
+ @cli.options = @cli.options.merge("sort" => "followers")
+ end
+ it "should sort by number of followers" do
+ @cli.suggest
+ $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
+ end
+ end
+ context "--sort=friends" do
+ before do
+ @cli.options = @cli.options.merge("sort" => "friends")
+ end
+ it "should sort by number of friends" do
+ @cli.suggest
+ $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
+ end
+ end
+ context "--sort=listed" do
+ before do
+ @cli.options = @cli.options.merge("sort" => "listed")
+ end
+ it "should sort by number of list memberships" do
+ @cli.suggest
+ $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
end
end
- context "--tweets" do
+ context "--sort=since" do
before do
- @cli.options = @cli.options.merge("tweets" => true)
+ @cli.options = @cli.options.merge("sort" => "since")
+ end
+ it "should sort by the time when Twitter acount was created" do
+ @cli.suggest
+ $stdout.string.chomp.should == "maccman mlroach jtrupiano stuntmann82 antpires"
+ end
+ end
+ context "--sort=tweets" do
+ before do
+ @cli.options = @cli.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@cli.suggest
$stdout.string.chomp.should == "stuntmann82 antpires jtrupiano maccman mlroach"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @cli.options = @cli.options.merge("tweeted" => true)
+ @cli.options = @cli.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@cli.suggest
@@ -3532,27 +3532,49 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
+ before do
+ @cli.options = @cli.options.merge("long" => true)
+ end
+ it "should output in long format" do
+ @cli.users("sferik", "pengwynn")
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
+ end
+ end
+ context "--reverse" do
before do
- @cli.options = @cli.options.merge("favorites" => true)
+ @cli.options = @cli.options.merge("reverse" => true)
+ end
+ it "should reverse the order of the sort" do
+ @cli.users("sferik", "pengwynn")
+ $stdout.string.chomp.should == "sferik pengwynn"
+ end
+ end
+ context "--sort=favorites" do
+ before do
+ @cli.options = @cli.options.merge("sort" => "favorites")
end
it "should sort by number of favorites" do
@cli.users("sferik", "pengwynn")
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--followers" do
+ context "--sort=followers" do
before do
- @cli.options = @cli.options.merge("followers" => true)
+ @cli.options = @cli.options.merge("sort" => "followers")
end
it "should sort by number of followers" do
@cli.users("sferik", "pengwynn")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=friends" do
before do
- @cli.options = @cli.options.merge("friends" => true)
+ @cli.options = @cli.options.merge("sort" => "friends")
end
it "should sort by number of friends" do
@cli.users("sferik", "pengwynn")
@@ -3573,58 +3595,36 @@
should have_been_made
end
end
- context "--listed" do
+ context "--sort=listed" do
before do
- @cli.options = @cli.options.merge("listed" => true)
+ @cli.options = @cli.options.merge("sort" => "listed")
end
it "should sort by number of list memberships" do
@cli.users("sferik", "pengwynn")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
- before do
- @cli.options = @cli.options.merge("long" => true)
- end
- it "should output in long format" do
- @cli.users("sferik", "pengwynn")
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
- end
- end
- context "--posted" do
+ context "--sort=since" do
before do
- @cli.options = @cli.options.merge("posted" => true)
+ @cli.options = @cli.options.merge("sort" => "since")
end
it "should sort by the time when Twitter acount was created" do
@cli.users("sferik", "pengwynn")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
- before do
- @cli.options = @cli.options.merge("reverse" => true)
- end
- it "should reverse the order of the sort" do
- @cli.users("sferik", "pengwynn")
- $stdout.string.chomp.should == "sferik pengwynn"
- end
- end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @cli.options = @cli.options.merge("tweets" => true)
+ @cli.options = @cli.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@cli.users("sferik", "pengwynn")
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @cli.options = @cli.options.merge("tweeted" => true)
+ @cli.options = @cli.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@cli.users("sferik", "pengwynn")
View
64 spec/list_spec.rb
@@ -192,85 +192,85 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
before do
- @list.options = @list.options.merge("favorites" => true)
+ @list.options = @list.options.merge("long" => true)
end
- it "should sort by number of favorites" do
+ it "should output in long format" do
@list.members("presidents")
- $stdout.string.chomp.should == "pengwynn sferik"
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
end
end
- context "--followers" do
+ context "--reverse" do
before do
- @list.options = @list.options.merge("followers" => true)
+ @list.options = @list.options.merge("reverse" => true)
end
- it "should sort by number of followers" do
+ it "should reverse the order of the sort" do
@list.members("presidents")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=favorites" do
before do
- @list.options = @list.options.merge("friends" => true)
+ @list.options = @list.options.merge("sort" => "favorites")
end
- it "should sort by number of friends" do
+ it "should sort by number of favorites" do
@list.members("presidents")
- $stdout.string.chomp.should == "sferik pengwynn"
+ $stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--listed" do
+ context "--sort=followers" do
before do
- @list.options = @list.options.merge("listed" => true)
+ @list.options = @list.options.merge("sort" => "followers")
end
- it "should sort by number of list memberships" do
+ it "should sort by number of followers" do
@list.members("presidents")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
+ context "--sort=friends" do
before do
- @list.options = @list.options.merge("long" => true)
+ @list.options = @list.options.merge("sort" => "friends")
end
- it "should output in long format" do
+ it "should sort by number of friends" do
@list.members("presidents")
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
+ $stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--posted" do
+ context "--sort=listed" do
before do
- @list.options = @list.options.merge("posted" => true)
+ @list.options = @list.options.merge("sort" => "listed")
end
- it "should sort by the time wshen Twitter account was created" do
+ it "should sort by number of list memberships" do
@list.members("presidents")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
+ context "--sort=since" do
before do
- @list.options = @list.options.merge("reverse" => true)
+ @list.options = @list.options.merge("sort" => "since")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time wshen Twitter account was created" do
@list.members("presidents")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @list.options = @list.options.merge("tweets" => true)
+ @list.options = @list.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@list.members("presidents")
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @list.options = @list.options.merge("tweeted" => true)
+ @list.options = @list.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@list.members("presidents")
View
64 spec/search_spec.rb
@@ -707,85 +707,85 @@
eos
end
end
- context "--favorites" do
+ context "--long" do
before do
- @search.options = @search.options.merge("favorites" => true)
+ @search.options = @search.options.merge("long" => true)
end
- it "should sort by number of favorites" do
+ it "should output in long format" do
@search.users("Erik")
- $stdout.string.chomp.should == "pengwynn sferik"
+ $stdout.string.should == <<-eos
+ID Since Last tweeted at Tweets Favorites Listed Following...
+14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
+ eos
end
end
- context "--followers" do
+ context "--reverse" do
before do
- @search.options = @search.options.merge("followers" => true)
+ @search.options = @search.options.merge("reverse" => true)
end
- it "should sort by number of followers" do
+ it "should reverse the order of the sort" do
@search.users("Erik")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--friends" do
+ context "--sort=favorites" do
before do
- @search.options = @search.options.merge("friends" => true)
+ @search.options = @search.options.merge("sort" => "favorites")
end
- it "should sort by number of friends" do
+ it "should sort by number of favorites" do
@search.users("Erik")
- $stdout.string.chomp.should == "sferik pengwynn"
+ $stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--listed" do
+ context "--sort=followers" do
before do
- @search.options = @search.options.merge("listed" => true)
+ @search.options = @search.options.merge("sort" => "followers")
end
- it "should sort by number of list memberships" do
+ it "should sort by number of followers" do
@search.users("Erik")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--long" do
+ context "--sort=friends" do
before do
- @search.options = @search.options.merge("long" => true)
+ @search.options = @search.options.merge("sort" => "friends")
end
- it "should output in long format" do
+ it "should sort by number of friends" do
@search.users("Erik")
- $stdout.string.should == <<-eos
-ID Since Last tweeted at Tweets Favorites Listed Following...
-14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
- 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
- eos
+ $stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--posted" do
+ context "--sort=listed" do
before do
- @search.options = @search.options.merge("posted" => true)
+ @search.options = @search.options.merge("sort" => "listed")
end
- it "should sort by the time wshen Twitter account was created" do
+ it "should sort by number of list memberships" do
@search.users("Erik")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--reverse" do
+ context "--sort=since" do
before do
- @search.options = @search.options.merge("reverse" => true)
+ @search.options = @search.options.merge("sort" => "since")
end
- it "should reverse the order of the sort" do
+ it "should sort by the time wshen Twitter account was created" do
@search.users("Erik")
$stdout.string.chomp.should == "sferik pengwynn"
end
end
- context "--tweets" do
+ context "--sort=tweets" do
before do
- @search.options = @search.options.merge("tweets" => true)
+ @search.options = @search.options.merge("sort" => "tweets")
end
it "should sort by number of Tweets" do
@search.users("Erik")
$stdout.string.chomp.should == "pengwynn sferik"
end
end
- context "--tweeted" do
+ context "--sort=tweeted" do
before do
- @search.options = @search.options.merge("tweeted" => true)
+ @search.options = @search.options.merge("sort" => "tweeted")
end
it "should sort by the time of the last Tweet" do
@search.users("Erik")

0 comments on commit 9d9d38c

Please sign in to comment.