On 14/8/07 21:30, "Scott Taylor" <[EMAIL PROTECTED]> wrote:
> How would you spec out something like the following:
>
> def a_method
>    x = Class.new do
>      include Enumerable
>    end
>
>    # do something here with x
> end
>
>
> describe "The Anonymous Class" do
>
>    before :each do
>      @anonymous_class = mock Class
>      Class.stub!(:new).and_return @anonymous_class
>    end
>
>    it "should create a new anonymous class" do
>      Class.should_receive(:new)
>      a_method
>    end
>
>    it "should include Enumerable" do
>      #... what goes here?
>    end
>
> end

Not being an expert, so apply the relevant pinches of salt! ...but if you're including enumerable, then it must be so that you can enumerate the class, so would the behavior driven approach be that you would test the enumerable behavior you wish the class to exhibit rather than the implementation of enabling this behavior by including the enumerable module.

Cheers

Rupert


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to