Permalink
Commits on Feb 21, 2013
  1. Fix rspec command in README.

    In response to http://stackoverflow.com/questions/15009603/rspec-fire-specs-passing-when-they-shouldnt.
    
    We need to load the lib file, and not simply put it on the load path.
    myronmarston committed Feb 21, 2013
Commits on Dec 27, 2012
Commits on Sep 27, 2012
Commits on Aug 11, 2012
  1. Fix use of const_get/const_defined? to handle undefined consts like F…

    …oo::Hash.
    
    When you name a nested constant that ends in a name that matches a top-level constant (such as "Foo::Hash"), rspec-fire was verifying the presence of a stubbed method on ::Hash if "Foo::Hash" was not defined. 1.9's const_get/const_defined? accepts a flag argument to have it ignore inherited/top-level constants, but 1.8 doesn't accept this argument, so we have to conditionally define methods to handle this properly.
    myronmarston committed Aug 11, 2012
  2. Remove RSpec 2.8 compatibility shim.

    We're only supporting 2.11+ now that it includes constant stubbing support.
    myronmarston committed Aug 11, 2012
Commits on Jul 10, 2012
  1. Merge pull request #19 from xaviershay/verify_constant_names

    Add verify_constant_names config option.
    myronmarston committed Jul 10, 2012
Commits on Jul 9, 2012
  1. Add verify_constant_names config option.

    When this is set to true, an error will be raised if a given constant name is undefined.
    myronmarston committed Jul 9, 2012
  2. Merge pull request #17 from xaviershay/remove_stub_const

    Remove stub_const
    myronmarston committed Jul 9, 2012
  3. RSpec 2.11 is out.

    myronmarston committed Jul 9, 2012
Commits on Jun 11, 2012
  1. Update rspec-fire to work with port of stub_const in rspec-mocks.

    rspec/rspec-mocks#146
    
    Note that this removes support for rspec 2.0...2.10
    (and rspec 2.11 isn't out yet), but there's no reason to
    maintain stub_const logic here now that it has been ported
    to rspec-mocks, and if you're updating to the latest rspec-fire
    than we assume you're probably doing the same with rspec.
    myronmarston committed Jun 11, 2012
  2. Lock to master branch of rspec-mocks for now.

    Once rspec 2.11 is released w/ the port of stub_const from here, we can change this so that it isn't locked to the git repo.
    myronmarston committed Jun 11, 2012
Commits on May 9, 2012
  1. Allow both instance and class doubles for unloaded classes.

    Previously, if you used both fire_double("Foo") and fire_replaced_class_double("Foo"), and Foo was not defined, stubbing or mocking a method on the fire double would fail because ConstantStubber.original_value_for returned nil for "Foo" (since it was originally unloaded), but the constant lookup would succeed and it would try to verify the implementation against the class stub.
    
    Now, ConstantStubber.find_original_value_for yields if the given class has been stubbed, and the value it yields can be nil if it was originally unloaded.  This allows us to support this edge case.
    myronmarston committed May 9, 2012
Commits on Mar 28, 2012
  1. Use original const value when checking implementation for fire_double.

    This allows fire_double and fire_replaced_class_double to both
    be used in the same example with the same doubled class.
    myronmarston committed Mar 28, 2012
  2. Fix specs on 1.8.7.

    The #stub! specs were generating failures:
    
      received unexpected message :stub
    
    Changing from an alias to a direct delegation fixed the problem.  Weird.  I don't understand that at all :(.
    myronmarston committed Mar 28, 2012
  3. Revert "Bump minimum rspec requirement to 2.6."

    This reverts commit 1b3ba96.
    
    This commit didn't have the intended affect, anyway, and is no longer
    needed.
    myronmarston committed Mar 28, 2012
  4. Ensure #stub! works (as an alias for #stub).

    This should fix the build on rspec 2.5 and 2.6 as well.
    myronmarston committed Mar 28, 2012
  5. Don't count block params when determining the max arity.

    Before this change, the following worked improperly:
    
      class A
        def m(a, &b)
        end
      end
    
      fire_double("A").stub(:m).with(:two, :arguments)
    
    The block arg was counted previously so this passed even though it should not.
    myronmarston committed Mar 28, 2012
Commits on Mar 23, 2012
  1. Allow `fire_double("Class", :foo => 17)` syntax.

    The ivars @__checked_methods and @__method_finder must be set before supering, so that when the superclass initializer calls #stub with each given message, the implementation can be checked.  Previously, you would get a 'nil is not a symbol' error.
    myronmarston committed Mar 23, 2012
Commits on Mar 22, 2012
  1. Handle default args and splat args properly.

    Unfortunately, on 1.8, there's no way to tell the difference between default args and splat args, so we can't fully support both. I've opted to be more liberal and treat it as a possible splat arg. This allows stubbing #with(1, 2) for a method like m(a=5), but I figure that's better than not allowing stubbing #with(1, 2) for a method like m(*a).
    
    On 1.9, it gives us the means of telling the difference between defaults and splats, so we handle it correctly.
    myronmarston committed Mar 22, 2012
Commits on Mar 21, 2012
  1. Use the new RSpec::Mocks::TestDouble module if it is available.

    See the following links for the background on this.
    
    * rspec/rspec-mocks#117
    * rspec/rspec-mocks@af3f296
    myronmarston committed Mar 21, 2012
Commits on Mar 18, 2012
  1. Fix #inspect on a fire class double for rubinius.

    Rubinius has a bug this is working around:
    
    rubinius/rubinius#1619
    myronmarston committed Mar 18, 2012
  2. Fix our rspec-mocks monkey patch to work on 1.8.

    On 1.8, #private_instance_methods returns an array of strings, not an array of symbols.
    myronmarston committed Mar 18, 2012
Commits on Mar 17, 2012
  1. Fix failing spec on 1.8.7.

    On 1.8.7, Module#constants returns an array of strings. On 1.9 it's an array of symbols.  We need to convert the given array to strings on 1.8.7 so the two arrays can be subtracted from each other.
    myronmarston committed Mar 17, 2012
Commits on Mar 14, 2012
  1. Raise a mock expectation error for undefined methods called on class …

    …doubles.
    
    We got this for free when FireClassDouble subclassed RSpec::Mocks::Mock; now that we're using modules, we need to define method_missing.
    myronmarston committed Mar 14, 2012
  2. Assign name to class doubles.

    #name is part of the standard class interface. It's a bit silly to make people stub it.
    myronmarston committed Mar 14, 2012
  3. Ensure class doubles have a readable string representation.

    "MyClass (fire double)" is much more readable than "#<Module:0x00000100956180>".
    myronmarston committed Mar 14, 2012
Commits on Mar 13, 2012