Sha256: 7911f3245f8f881fa61f72ad69dd844b076e404d0f9b39b6f1ba87dec63c9a66

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'test_helper'

class CsvBootstrapTest < Test::Unit::TestCase
  def setup
    CsvBootstrapTestHelper.setup_database
    @bootstrap = CsvBootstrap.new(:target_class_name => 'Scrum', :url => GDOCS_URL, :sheet => 1)
  end
  
  def teardown
    Scrum.clear_bootstraps
    CsvBootstrapTestHelper.teardown_database
  end
  
  def test_should_have_target_class_name
    assert_equal @bootstrap.target_class_name, 'Scrum'
  end
  
  def test_should_have_zero_based_sheet
    assert_equal @bootstrap.sheet, 0
  end
  
  def test_should_set_url
    bootstrap = CsvBootstrap.new(:target_class_name => 'Scrum', :url => CSV_URL)
    assert_equal bootstrap.url, CSV_URL
  end
  
  def test_should_set_and_modify_gdocs_url
    assert_equal @bootstrap.url, GDOCS_URL + '&output=csv&gid=0'
  end
  
  def test_should_raise_if_gdocs_url_includes_gid
    assert_raise RuntimeError do
      CsvBootstrap.new(:target_class_name => 'Scrum', :url => GDOCS_URL + '&gid=1')
    end
  end

  def test_should_bootstrap_keys
    Scrum.expects(:find_or_create_by_name).at_least_once.returns(Scrum.new)
    @bootstrap.bootstrap!
  end
  
  def test_should_bootstrap_values
    Scrum.any_instance.expects(:update_attributes).at_least_once
    @bootstrap.bootstrap!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seamusabshere-csv_bootstrap-0.1.0 test/csv_bootstrap_test.rb