Created
January 24, 2012 23:23
-
-
Save laribee/1673446 to your computer and use it in GitHub Desktop.
using a wrapper to stub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Wrapper | |
| def self.some_windows_dependent_stuff | |
| require "win32/registry" | |
| # use windows stuff | |
| end | |
| end | |
| class Subject | |
| def where_i_need_it | |
| Wrapper.some_windows_dependent_stuff | |
| end | |
| end | |
| describe Subject do | |
| it "puts the lotion on its skin" do | |
| Wrapper.stub(:some_windows_dependent_stuff) { :foo } | |
| Subject.new.where_i_need_it.should eql(:foo) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ended up just hacking around it for now. It's ugly, but...