Skip to content

Commit

Permalink
Don't add new placeholder records to existing DBs. [#4]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Dec 4, 2009
1 parent 895e9fa commit 72372db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/ruby/data_table_model.rb
Expand Up @@ -17,16 +17,18 @@ def initialize(filename)
end
end

# Make some placeholder data for now.
@data = @db[:table]
values = 1.upto(row_count).collect do |r|
h = {}
1.upto(column_count) do |c|
h[:"column_#{c}"] = "R#{r}, C#{c}"
if @data.empty?
# Make some placeholder data for now.
values = 1.upto(row_count).collect do |r|
h = {}
1.upto(column_count) do |c|
h[:"column_#{c}"] = "R#{r}, C#{c}"
end
h
end
h
@data.multi_insert values
end
@data.multi_insert values
end

def column_count
Expand Down
4 changes: 4 additions & 0 deletions spec/data_table_model_spec.rb
Expand Up @@ -31,6 +31,10 @@
DataTableModel.new filename
lambda {DataTableModel.new filename}.should_not raise_error
end

it "should not add new rows to an existing data table just by opening it" do
pending "can't really spec this yet, since row_count is stubbed"
end
end

describe "instance methods" do
Expand Down

0 comments on commit 72372db

Please sign in to comment.