Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBahi Hussien
Courses Plus Student 13,128 PointsSQLite3::CorruptException: database disk image is malformed
Hi, It is my first time to encounter such error. please inform me why such error may happen and how to fix.
in the ruby todo list course > relationships lesson.
i ran the following commands
bin/rails generate model todo_item todo_list:references content:string
bin/rake db:migrate
bin/rake db:migrate RAILS_ENV=test
errors shown in terminal
rake aborted!
ActiveRecord::StatementInvalid: SQLite3::CorruptException: database disk image is malformed: SELECT name
FROM sqlite_master
WHERE (type = 'table' OR type = 'view') AND NOT name = 'sqlite_sequence'
AND name = "schema_migrations"
-e:1:in `<main>'
SQLite3::CorruptException: database disk image is malformed
-e:1:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
--trace shows
** Invoke default (first_time)
** Invoke spec (first_time)
** Invoke spec:prepare (first_time)
** Execute spec:prepare
** Execute spec
/Users/bahihussein/.rbenv/versions/2.1.5/bin/ruby -S rspec ./spec/controllers/todo_lists_controller_spec.rb ./spec/features/todo_lists/create_spec.rb ./spec/helpers/todo_lists_helper_spec.rb ./spec/models/todo_item_spec.rb ./spec/models/todo_list_spec.rb ./spec/requests/todo_lists_spec.rb ./spec/routing/todo_lists_routing_spec.rb ./spec/views/todo_lists/edit.html.erb_spec.rb ./spec/views/todo_lists/index.html.erb_spec.rb ./spec/views/todo_lists/new.html.erb_spec.rb ./spec/views/todo_lists/show.html.erb_spec.rb
DEPRECATION WARNING: named_routes.helpers
is deprecated, please use route_defined?(route_name)
to see if a named route was defined. (called from block (3 levels) in <top (required)> at /Users/bahihussein/git/ruby/odot/spec/controllers/todo_lists_controller_spec.rb:156)
..............DEPRECATION WARNING: named_routes.helpers
is deprecated, please use route_defined?(route_name)
to see if a named route was defined. (called from block (4 levels) in <top (required)> at /Users/bahihussein/git/ruby/odot/spec/controllers/todo_lists_controller_spec.rb:75)
............*....
Pending: TodoItem add some examples to (or delete) /Users/bahihussein/git/ruby/odot/spec/models/todo_item_spec.rb # No reason given # ./spec/models/todo_item_spec.rb:4 TodoListsHelper add some examples to (or delete) /Users/bahihussein/git/ruby/odot/spec/helpers/todo_lists_helper_spec.rb # No reason given # ./spec/helpers/todo_lists_helper_spec.rb:14 TodoList add some examples to (or delete) /Users/bahihussein/git/ruby/odot/spec/models/todo_list_spec.rb # No reason given # ./spec/models/todo_list_spec.rb:4
Deprecation Warnings:
RSpec::Core::ExampleGroup#example is deprecated and will be removed in RSpec 3. There are a few options for what you can use instead:
- rspec-core's DSL methods (
it
,before
,after
,let
,subject
, etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts. - The current example is now exposed via
RSpec.current_example
, which is accessible from any context. -
If you can't update the code at this call site (e.g. because it is in an extension gem), you can use this snippet to continue making this method available in RSpec 2.99 and RSpec 3:
RSpec.configure do |c| c.expose_current_running_example_as :example end
(Called from /Users/bahihussein/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/capybara-2.1.0/lib/capybara/rspec.rb:20:in `block (2 levels) in <top (required)>')
RSpec::Core::ExampleGroup#example is deprecated and will be removed in RSpec 3. There are a few options for what you can use instead:
- rspec-core's DSL methods (
it
,before
,after
,let
,subject
, etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts. - The current example is now exposed via
RSpec.current_example
, which is accessible from any context. -
If you can't update the code at this call site (e.g. because it is in an extension gem), you can use this snippet to continue making this method available in RSpec 2.99 and RSpec 3:
RSpec.configure do |c| c.expose_current_running_example_as :example end
(Called from /Users/bahihussein/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/capybara-2.1.0/lib/capybara/rspec.rb:21:in `block (2 levels) in <top (required)>')
The semantics of RSpec::Core::ExampleGroup.pending
are changing in RSpec 3.
In RSpec 2.x, it caused the example to be skipped. In RSpec 3, the example will
still be run but is expected to fail, and will be marked as a failure (rather
than as pending) if the example passes, just like how pending
with a block
from within an example already works.
To keep the same skip semantics, change pending
to skip
. Otherwise, if you
want the new RSpec 3 behavior, you can safely ignore this warning and continue
to upgrade to RSpec 3 without addressing it.
Called from /Users/bahihussein/git/ruby/odot/spec/helpers/todo_lists_helper_spec.rb:14:in `block in <top (required)>'.
The semantics of RSpec::Core::ExampleGroup.pending
are changing in RSpec 3.
In RSpec 2.x, it caused the example to be skipped. In RSpec 3, the example will
still be run but is expected to fail, and will be marked as a failure (rather
than as pending) if the example passes, just like how pending
with a block
from within an example already works.
To keep the same skip semantics, change pending
to skip
. Otherwise, if you
want the new RSpec 3 behavior, you can safely ignore this warning and continue
to upgrade to RSpec 3 without addressing it.
Called from /Users/bahihussein/git/ruby/odot/spec/models/todo_item_spec.rb:4:in `block in <top (required)>'.
The semantics of RSpec::Core::ExampleGroup.pending
are changing in RSpec 3.
In RSpec 2.x, it caused the example to be skipped. In RSpec 3, the example will
still be run but is expected to fail, and will be marked as a failure (rather
than as pending) if the example passes, just like how pending
with a block
from within an example already works.
To keep the same skip semantics, change pending
to skip
. Otherwise, if you
want the new RSpec 3 behavior, you can safely ignore this warning and continue
to upgrade to RSpec 3 without addressing it.
Called from /Users/bahihussein/git/ruby/odot/spec/models/todo_list_spec.rb:4:in `block in <top (required)>'.
stub_model
is deprecated. Use the rspec-activemodel-mocks
gem instead. Called from /Users/bahihussein/git/ruby/odot/spec/views/todo_lists/new.html.erb_spec.rb:5:in block (2 levels) in <top (required)>'.
stub_modelis deprecated. Use the
rspec-activemodel-mocksgem instead. Called from /Users/bahihussein/git/ruby/odot/spec/views/todo_lists/index.html.erb_spec.rb:6:in
block (2 levels) in <top (required)>'.
stub_model
is deprecated. Use the rspec-activemodel-mocks
gem instead. Called from /Users/bahihussein/git/ruby/odot/spec/views/todo_lists/index.html.erb_spec.rb:10:in block (2 levels) in <top (required)>'.
Too many uses of deprecated '
stub_model'. Pass
--deprecation-outor set
config.deprecation_stream` to a file for full output.
If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
config.raise_errors_for_deprecations!
, and it will turn the
deprecation warnings into errors, giving you the full backtrace.
10 deprecation warnings total
Finished in 0.31909 seconds 33 examples, 0 failures, 3 pending
Randomized with seed 31866
** Execute default
schema.rb
ActiveRecord::Schema.define(version: 20150301071327) do
create_table "todo_items", force: :cascade do |t|
t.integer "todo_list_id"
t.string "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "todo_items", ["todo_list_id"], name: "index_todo_items_on_todo_list_id"
create_table "todo_lists", force: :cascade do |t|
t.string "title"
t.text "desc"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
1 Answer
Kevin Zoltany
16,282 PointsSorry about the delay but if you still need help with this problem, then go to terminal and type this. It should work.
rake db:drop
rake db:create
rake db:migrate