I’ve seen several posts related, but not touching on what I’m
wondering…
I have a lib module that I’d like to do ‘white-box’ testing - similar
to a Rails mvc. But I can’t see how to get a handle on the internal
instance vars in the method.
here are some code snippets that probably best explain my situation…
#########################################################
require File.expand_path(File.dirname(FILE) + ‘/…/spec_helper’)
describe AasmCrawler do
context “create_message method” do
it “should create a new Link message” do
@link.should == Link.new
end
end
end
#########################################################
module AasmCrawler
def create_message
@link = Link.new
end
end
#########################################################
I’ve tried “assigns[:link]” but “assigns” is not known.
I’ve also seen comments to test this via a model where it is included
- but that seems like WET testing, if this is used repeatedly why not
test it once at the source?
thanks for any help