Re: [jruby-user] query does not return ResultSet while running spec
Keith Bennett <[email protected]> Sun, 8 Feb 2015 12:59:28 -0500
| Newsgroups | gmane.comp.lang.jruby.user |
|---|---|
| Message-ID | <[email protected]> |
Chandra - I don’t know anything about this, but my gut feeling is that it might be helpful to pare down the test so that there are fewer moving parts. For example: * does Sqlite access work at all, even with a simple query in plain JRuby without Rails? * is there a way to test FactoryGirl to see that it’s doing what you think it’s doing without a data base? Also, I noticed you used Postgres before but commented it out, but switched to Sqlite. Were you having a similar problem with Postgres? - Keith > On Feb 8, 2015, at 10:45 AM, Chandra Sekhar <[email protected]> wrote: > > hi i have created Blog project using rails.when running spec getting > below error. > > Article has a valid factory > Failure/Error: @article = build( :article) > ActiveRecord::StatementInvalid: > ActiveRecord::JDBCError: query does not return ResultSet: PRAGMA > table_info("articles") > # arjdbc/jdbc/RubyJdbcConnection.java:734:in `execute_query_raw' > # > /Users/ChandrasekharPasupuleti/.rvm/gems/jruby-1.7.11/gems/activerecord-jdbc-adapter-1.3.13/lib/arjdbc/sqlite3/adapter.rb:344:in > `table_structure' > # > /Users/ChandrasekharPasupuleti/.rvm/gems/jruby-1.7.11/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_adapter.rb:280:in > `log' > # > /Users/ChandrasekharPasupuleti/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.17/lib/active_support/notifications/instrumenter.rb:20:in > `instrument' > # > /Users/ChandrasekharPasupuleti/.rvm/gems/jruby-1.7.11/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_adapter.rb:275:in > `log' > # > /Users/ChandrasekharPasupuleti/.rvm/gems/jruby-1.7.11/gems/activerecord-jdbc-adapter-1.3.13/lib/arjdbc/sqlite3/adapter.rb:344:in > `table_structure' > # /Users/ChandrasekharPasupuleti/. > > > Gemfile > > source 'https://rubygems.org' > > gem 'rails', '3.2.17' > > # Bundle edge Rails instead: > # gem 'rails', :git => 'git://github.com/rails/rails.git' > > gem 'activerecord-jdbcsqlite3-adapter' > gem 'jruby-openssl' > > group :development, :test do > gem 'ffaker' > gem 'factory_girl_rails' > gem 'rspec-rails' > gem 'fixture_builder', github: "pivotal-sharknado/fixture_builder", > ref: "2ff43b5454979c44ba0b0420f5654fe0409592fb" > gem 'jasmine-rails' > gem 'jasmine-jquery-rails' > gem 'pry-nav' > gem 'quiet_assets' > end > > # Gems used only for assets and not required > # in production environments by default. > group :assets do > gem 'sass-rails', '~> 3.2.3' > gem 'coffee-rails', '~> 3.2.1' > > # See https://github.com/sstephenson/execjs#readme for more supported > runtimes > gem 'therubyrhino' > > gem 'uglifier', '>= 1.0.3' > end > > gem 'jquery-rails' > > # To use ActiveModel has_secure_password > # gem 'bcrypt-ruby', '~> 3.0.0' > > # To use Jbuilder templates for JSON > # gem 'jbuilder' > > # Use unicorn as the app server > # gem 'unicorn' > > # Deploy with Capistrano > # gem 'capistrano' > > # To use debugger > # gem 'debugger' > > > Spec-helper------- > > ENV["RAILS_ENV"] ||= 'test' > require 'rubygems' > require 'rails/all' > require_relative '../app/models/article.rb' > require_relative '../spec/factories/articles.rb' > require 'factory_girl' > require 'java' > #requ'ire 'jdbc/postgres' > #Jdbc::Postgres.load_driver > ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database > => ":memory:") > RSpec.configure do |config| > config.include FactoryGirl::Syntax::Methods > end > > > Spec------ > > require 'spec_helper' > > describe Article do > it "has a valid factory" do > @article = build( :article) > end > end > > > > factory--- > > > require 'factory_girl' > > FactoryGirl.define do > factory :article do |f| > f.title "John" > f.text "Doe hjhj hb" > f.created_at "2014-11-21 04:48:39.000000000" > f.updated_at "2014-11-21 04:48:39.000000000" > end > end > > -- > Posted via http://www.ruby-forum.com/. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email