-
-
Save yorickpeterse/cff63c2df5d91783b815 to your computer and use it in GitHub Desktop.
This file contains 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 SomeScraper | |
def initialize(document) | |
@document = document | |
end | |
def parse | |
return @document.at('p.foo').text | |
end | |
end | |
# some_scraper_spec.rb | |
describe SomeScraper do | |
before do | |
node = double(:node, :text => 'Foo') | |
document = double(:document, :at => node) | |
@scraper = described_class.new(document) | |
end | |
example 'return the text' do | |
@scraper.parse.should == 'Foo' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment