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 GitHub - sstephenson/execjs: Run JavaScript code from Ruby 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