Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 1406 Bytes
1 | require File.dirname(__FILE__) + "/../spec_helper" |
2 | |
3 | describe MethodObserver do |
4 | |
5 | class TestObserver < MethodObserver |
6 | def before_observed_method(*args, &block); end |
7 | def after_observed_method(*args); end |
8 | end |
9 | |
10 | class TestObject |
11 | def observed_method |
12 | :success |
13 | end |
14 | end |
15 | |
16 | before :each do |
17 | @object = TestObject.new |
18 | @object.stub!(:before_result=).and_return(nil) |
19 | @object.stub!(:after_result=).and_return(:success) |
20 | @observer = TestObserver.new |
21 | @observer.observe(@object) |
22 | end |
23 | |
24 | it "should permit only one object to be observed" do |
25 | lambda { @observer.observe(@object)}.should raise_error(MethodObserver::ObserverCannotObserveTwiceError) |
26 | end |
27 | |
28 | it "should have a target equal to the observed object" do |
29 | @observer.should respond_to(:target) |
30 | @observer.target.should == @object |
31 | end |
32 | |
33 | it "should invoke the before_ method before the object's method is invoked" do |
34 | @observer.should_receive(:before_observed_method) do |
35 | @observer.result.should be_nil |
36 | end |
37 | @object.observed_method.should == :success |
38 | @observer.result.should == :success |
39 | end |
40 | |
41 | it "should invoke the after_ method after the object's method is invoked" do |
42 | @observer.should_receive(:after_observed_method) do |
43 | @observer.result.should == :success |
44 | end |
45 | @object.observed_method.should == :success |
46 | @observer.result.should == :success |
47 | end |
48 | end |