spec/scraper_spec.rb in right_scraper-1.0.9 vs spec/scraper_spec.rb in right_scraper-1.0.10
- old
+ new
@@ -20,46 +20,48 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
require File.join(File.dirname(__FILE__), 'spec_helper')
-require File.join('scrapers', 'git_scraper')
-require File.join('scrapers', 'svn_scraper')
-require File.join('scrapers', 'download_scraper')
-require 'scraper'
+require File.join(File.dirname(__FILE__), '..', 'lib', 'right_scraper', 'scraper_base')
+require File.join(File.dirname(__FILE__), '..', 'lib', 'right_scraper', 'scrapers', 'git_scraper')
+require File.join(File.dirname(__FILE__), '..', 'lib', 'right_scraper', 'scrapers', 'svn_scraper')
+require File.join(File.dirname(__FILE__), '..', 'lib', 'right_scraper', 'scrapers', 'download_scraper')
+require File.join(File.dirname(__FILE__), '..', 'lib', 'right_scraper', 'repository')
+require File.join(File.dirname(__FILE__), '..', 'lib', 'right_scraper', 'scraper')
describe RightScale::Scraper do
before(:each) do
@scraper = RightScale::Scraper.new('/tmp')
@mock_scraper = flexmock('MockScraper')
mock_scraper_klass = flexmock('MockScraperClass', :new => @mock_scraper)
- RightScale::SCRAPERS.merge!(:mock => mock_scraper_klass)
+ RightScale::SCRAPERS.merge!('mock' => mock_scraper_klass)
end
after(:all) do
- RightScale::SCRAPERS.delete(:mock)
+ RightScale::SCRAPERS.delete('mock')
end
it 'should scrape' do
repo = RightScale::Repository.new
repo.repo_type = :mock
- @mock_scraper.should_receive(:scrape).with(repo, Proc).and_return(true)
+ @mock_scraper.should_receive(:scrape).with(repo, true, Proc).and_return(true)
@mock_scraper.should_receive(:succeeded?).and_return(true)
@mock_scraper.should_receive(:current_repo_dir).and_return('42')
@scraper.scrape(repo) { }.should be_true
@scraper.last_repo_dir.should == '42'
end
it 'should scrape from a hash' do
- @mock_scraper.should_receive(:scrape).with(RightScale::Repository, Proc).and_return(true)
+ @mock_scraper.should_receive(:scrape).with(RightScale::Repository, true, Proc).and_return(true)
@mock_scraper.should_receive(:succeeded?).and_return(true)
@mock_scraper.should_receive(:current_repo_dir).and_return('42')
@scraper.scrape({:repo_type => :mock}) { }.should be_true
end
it 'should report failures' do
- @mock_scraper.should_receive(:scrape).with(RightScale::Repository, Proc).and_return(true)
+ @mock_scraper.should_receive(:scrape).with(RightScale::Repository, true, Proc).and_return(true)
@mock_scraper.should_receive(:succeeded?).and_return(false)
@mock_scraper.should_receive(:current_repo_dir).and_return('42')
@scraper.scrape({:repo_type => :mock}) { }.should be_false
end