File: methods_spec.rb

package info (click to toggle)
ruby-rspec-mocks 2.14.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 868 kB
  • ctags: 725
  • sloc: ruby: 8,227; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 844 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

module RSpec
  module Mocks
    describe "Methods added to every object" do
      include_context "with syntax", :expect

      def added_methods
        host = Class.new
        orig_instance_methods = host.instance_methods
        Syntax.enable_should(host)
        (host.instance_methods - orig_instance_methods).map(&:to_sym)
      end

      it 'limits the number of methods that get added to all objects' do
        # If really necessary, you can add to this list, but long term,
        # we are hoping to cut down on the number of methods added to all objects
        expect(added_methods).to match_array([
          :as_null_object, :null_object?,
          :received_message?, :should_not_receive, :should_receive,
          :stub, :stub!, :stub_chain, :unstub, :unstub!
        ])
      end
    end
  end
end