whats_up 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec CHANGED
@@ -1 +1,2 @@
1
1
  --color
2
+ --require spec_helper
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in rupee.gemspec
3
+ # Specify your gem's dependencies in whats_up.gemspec
4
4
  gemspec
data/Rakefile CHANGED
@@ -1,6 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
2
3
  require "sdoc"
3
4
 
5
+ RSpec::Core::RakeTask.new("spec")
6
+
4
7
  # Quick hack until SDoc gets fixed
5
8
  class RDoc::Generator::SDoc; alias :basedir :base_dir; end
6
9
 
@@ -18,6 +18,10 @@ module WhatsUp
18
18
  alias :works? :what_works_with
19
19
  alias :not_blank? :whats_not_blank_with
20
20
  end
21
+
22
+ class MethodFinder
23
+ @@blacklist += Classic.instance_methods
24
+ end
21
25
  end
22
26
 
23
27
  class Object # :nodoc:
@@ -3,16 +3,15 @@ module WhatsUp
3
3
  # values with an expected result. ny matches will then be pretty printed to the console.
4
4
  class MethodFinder
5
5
  # A list of symbols indicated which methods to always ignore
6
- @@blacklist = %w(daemonize debug debugger display ed emacs exactly? exec exit! fork given
7
- matches? mate nano not_blank? sleep stub stub! stub_chain syscall system unstub
8
- unstub! vi vim what? what_equals what_matches what_works what_works_with
9
- whats_exactly whats_not_blank whats_not_blank_with works?).map(&:to_sym)
6
+ @@blacklist = %w(daemonize debug debugger display ed emacs exec exit! fork mate nano sleep
7
+ stub stub! stub_chain syscall system unstub unstub! vi vim).map(&:to_sym)
8
+ @@blacklist += Methods.instance_methods
10
9
 
11
10
  # A list of symbols for infix operators for which Ruby has special syntax
12
- @@infixes = %w(+ - * / % ** == != =~ !~ !=~ > < >= <= <=> === & | ^ << >>).map(&:to_sym)
11
+ @@infixes = %w(+ - * / % ** == != =~ !~ !=~ > < >= <= <=> === & | ^ << >>).map(&:to_sym)
13
12
 
14
13
  # A list of symbols for prefix operators for which Ruby has special syntax
15
- @@prefixes = %w(+@ -@ ~ !).map(&:to_sym)
14
+ @@prefixes = %w(+@ -@ ~ !).map(&:to_sym)
16
15
 
17
16
  class << self
18
17
  # Builds a lambda for checking against the provided +expected_result+ given a hash of options.
@@ -44,6 +44,20 @@ module WhatsUp
44
44
  end
45
45
  alias :whats_not_blank :whats_not_blank_with
46
46
 
47
+ # The list of all methods unique to an object
48
+ def unique_methods
49
+ methods - self.class.methods
50
+ end
51
+
52
+ # Lists all methods available to the object by ancestor
53
+ def methods_by_ancestor
54
+ result = {}
55
+ ([self] + self.class.ancestors).each do |object|
56
+ result[object] = object.unique_methods
57
+ end
58
+ result
59
+ end
60
+
47
61
  # Make sure cloning doesn't cause anything to fail via type errors
48
62
  alias_method :__clone__, :clone
49
63
 
@@ -1,4 +1,4 @@
1
1
  module WhatsUp
2
2
  # The current version
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.2"
4
4
  end
data/spec/classic_spec.rb CHANGED
@@ -1,5 +1,3 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
2
-
3
1
  describe "WhatsUp::Classic" do
4
2
  it "should not have any classic methods without Classic loaded" do
5
3
  "hello".should_not respond_to(:what?)
@@ -1,5 +1,3 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
2
-
3
1
  describe FrozenSection do
4
2
  describe "initialization" do
5
3
  before :each do
@@ -0,0 +1,13 @@
1
+ describe MethodFinder do
2
+ describe "blacklist" do
3
+ it "should contain classic methods" do
4
+ MethodFinder.class_variable_get(:@@blacklist).should include(:what?)
5
+ MethodFinder.class_variable_get(:@@blacklist).should include(:works?)
6
+ end
7
+
8
+ it "should contain newer methods" do
9
+ MethodFinder.class_variable_get(:@@blacklist).should include(:what_equals)
10
+ MethodFinder.class_variable_get(:@@blacklist).should include(:what_works)
11
+ end
12
+ end
13
+ end
data/spec/methods_spec.rb CHANGED
@@ -1,5 +1,3 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
2
-
3
1
  describe Methods do
4
2
  before :all do
5
3
  @stderr, @stdout = $stderr, $stdout
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whats_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-24 00:00:00.000000000 Z
13
+ date: 2012-03-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sdoc
@@ -132,6 +132,7 @@ files:
132
132
  - lib/whats_up/version.rb
133
133
  - spec/classic_spec.rb
134
134
  - spec/frozen_section_spec.rb
135
+ - spec/method_finder_spec.rb
135
136
  - spec/methods_spec.rb
136
137
  - spec/spec_helper.rb
137
138
  - whats_up.gemspec
@@ -162,5 +163,6 @@ summary: Determine what methods can be called on an object that return a given v
162
163
  test_files:
163
164
  - spec/classic_spec.rb
164
165
  - spec/frozen_section_spec.rb
166
+ - spec/method_finder_spec.rb
165
167
  - spec/methods_spec.rb
166
168
  - spec/spec_helper.rb