Sha256: 54a33887f9e7d2ffd8f0a47a0f04faecd6988bf209029ec293294c79c8d6afa3

Contents?: true

Size: 1.73 KB

Versions: 15

Compression:

Stored size: 1.73 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

include RR

describe TableScan do
  before(:each) do
    Initializer.configuration = standard_config
  end

  it "initialize should raise exception if table doesn't have primary keys" do
    session = Session.new
    lambda {TableScan.new session, 'extender_without_key'} \
      .should raise_error(RuntimeError, /.*extender_without_key.*primary key/)
  end

  it "initialize should cache the primary keys of the given table" do
    session = Session.new
    scann = TableScan.new session, 'scanner_records'
    scann.primary_key_names.should == ['id']
  end

  it "initialize should use the name of the left table as overwritable default for right table" do
    session = Session.new
    TableScan.new(session, 'scanner_records').right_table.should == 'scanner_records'
    TableScan.new(session, 'scanner_records', 'dummy').right_table.should == 'dummy'
  end

  it "progress_printer= should store the progress printer class" do
    session = Session.new
    TableScan.new(session, 'scanner_records').progress_printer = :dummy_printer_class
  end

  it "update_progres should create the progress printer and report the progress" do
    session = Session.new
    scan = TableScan.new(session, 'extender_one_record', 'extender_no_record')

    progress_printer_class = mock("progress printer class")
    progress_printer = mock("progress printer")
    progress_printer_class.should_receive(:new).
      with(1, scan.session, 'extender_one_record', 'extender_no_record').
      and_return(progress_printer)
    progress_printer.should_receive(:step).with(2)
    progress_printer.should_receive(:step).with(3)

    scan.progress_printer = progress_printer_class
    scan.update_progress 2
    scan.update_progress 3
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
andyjeffries-rubyrep-1.2.1 spec/table_scan_spec.rb
rubyrep-1.2.0 spec/table_scan_spec.rb
rubyrep-1.1.2 spec/table_scan_spec.rb
rubyrep-1.1.1 spec/table_scan_spec.rb
rubyrep-1.1.0 spec/table_scan_spec.rb
rubyrep-1.0.9 spec/table_scan_spec.rb
rubyrep-1.0.8 spec/table_scan_spec.rb
rubyrep-1.0.3 spec/table_scan_spec.rb
rubyrep-1.0.4 spec/table_scan_spec.rb
rubyrep-1.0.5 spec/table_scan_spec.rb
rubyrep-1.0.6 spec/table_scan_spec.rb
rubyrep-1.0.7 spec/table_scan_spec.rb
rubyrep-1.0.2 spec/table_scan_spec.rb
rubyrep-1.0.0 spec/table_scan_spec.rb
rubyrep-1.0.1 spec/table_scan_spec.rb