Push rejected, failed to compile ruby app -
currently @ chapter 3 of michael hartl's tutorial , keep running problem:
c:/users/huihui/sutdweb/spec/spec_helper.rb:82:in `block in <top (required)>': u ninitialized constant capybara (nameerror)
this gemfile.rb:
source 'https://rubygems.org' ruby '1.9.3' gem 'rails', '4.1.1' gem 'sqlite3-ruby', '1.3.1', :require => 'sqlite3' group :development, :test gem 'sqlite3' gem 'rspec-rails' end group :test gem 'selenium-webdriver', '2.35.1' gem 'capybara', '2.3.0' end gem 'sass-rails', '4.0.1' gem 'uglifier', '2.1.1' gem 'coffee-rails', '4.0.1' gem 'jquery-rails', '3.0.4' gem 'turbolinks', '1.1.1' gem 'jbuilder', '1.0.2' group :doc gem 'sdoc', '0.3.20', require: false end group :production gem 'pg', '0.15.1' gem 'rails_12factor', '0.0.2' end
and spec_helper.rb:
# file generated `rails generate rspec:install` command. conventionally, # specs live under `spec` directory, rspec adds `$load_path`. # generated `.rspec` file contains `--require spec_helper` cause # file loaded, without need explicitly require in files. # # given loaded, encouraged keep file # light-weight possible. requiring heavyweight dependencies file # add boot time of test suite on every test run, # individual file may not need of loaded. instead, make # separate helper file requires 1 , use in specs # need it. # # `.rspec` file contains few flags not defaults # users commonly want. # # see http://rubydoc.info/gems/rspec-core/rspec/core/configuration # require 'rspec/rails' # require 'active_support' # require 'active_support/core_ext' require 'rspec/rails' require 'capybara/rails' rspec.configure |config| # settings below suggested provide initial experience # rspec, feel free customize heart's content. # these 2 settings work allow limit spec run # individual examples or groups care tagging them # `:focus` metadata. when nothing tagged `:focus`, examples # run. config.filter_run :focus config.run_all_when_everything_filtered = true # many rspec users commonly either run entire suite or individual # file, , it's useful allow more verbose output when running # individual spec file. if config.files_to_run.one? # use documentation formatter detailed output, # unless formatter has been configured # (e.g. via command-line flag). config.default_formatter = 'doc' end # print 10 slowest examples , example groups @ # end of spec run, surface specs running # particularly slow. config.profile_examples = 10 # run specs in random order surface order dependencies. if find # order dependency , want debug it, can fix order providing # seed, printed after each run. # --seed 1234 config.order = :random # seed global randomization in process using `--seed` cli option. # setting allows use `--seed` deterministically reproduce # test failures related randomization passing same `--seed` value # 1 triggered failure. kernel.srand config.seed # rspec-expectations config goes here. can use alternate # assertion/expectation library such wrong or stdlib/minitest # assertions if prefer. config.expect_with :rspec |expectations| # enable newer, non-monkey-patching expect syntax. # more details, see: # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax expectations.syntax = :expect end # rspec-mocks config goes here. can use alternate test double # library (such bogus or mocha) changing `mock_with` option here. config.mock_with :rspec |mocks| # enable newer, non-monkey-patching expect syntax. # more details, see: # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ mocks.syntax = :expect # prevents mocking or stubbing method not exist on # real object. recommended. mocks.verify_partial_doubles = true end config.include capybara::dsl end
rails_helper.rb:
# file copied spec/ when run 'rails generate rspec:install' env["rails_env"] ||= 'test' require 'spec_helper' require file.expand_path("../../config/environment", __file__) require 'rspec/rails' # requires supporting ruby files custom matchers , macros, etc, in # spec/support/ , subdirectories. files matching `spec/**/*_spec.rb` # run spec files default. means files in spec/support end # in _spec.rb both required , run specs, causing specs # run twice. recommended not name files matching glob # end _spec.rb. can configure pattern with --pattern # option on command line or in ~/.rspec, .rspec or `.rspec-local`. dir[rails.root.join("spec/support/**/*.rb")].each { |f| require f } # checks pending migrations before tests run. # if not using activerecord, can remove line. activerecord::migration.maintain_test_schema! rspec.configure |config| # remove line if you're not using activerecord or activerecord fixtures config.fixture_path = "#{::rails.root}/spec/fixtures" # if you're not using activerecord, or you'd prefer not run each of # examples within transaction, remove following line or assign false # instead of true. config.use_transactional_fixtures = true # rspec rails can automatically mix in different behaviours tests # based on file location, example enabling call `get` , # `post` in specs under `spec/controllers`. # # can disable behaviour removing line below, , instead # explicitly tag specs type, e.g.: # # rspec.describe userscontroller, :type => :controller # # ... # end # # different available types documented in features, such in # https://relishapp.com/rspec/rspec-rails/docs config.infer_spec_type_from_file_location! end
when did git push heroku
, gave me following error:
installing rdoc 3.12.2 installing pg 0.15.1 error occurred while installing sqlite3-ruby (1.3.1), , bundler cann ot continue. make sure `gem install sqlite3-ruby -v '1.3.1'` succeeds before bund ling. ! ! failed install gems via bundler. ! ! detected sqlite3 gem not supported on heroku. ! https://devcenter.heroku.com/articles/sqlite3 ! ! push rejected, failed compile ruby app git@heroku.com:sutdweb.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed push refs 'git@heroku.com:sutdweb.git'
why push rejected? can shed light on this?
capybara
in gemfile
, move capybara
out of test
gems :
#gemfile gem `capybara`
heroku install generic
, production
gems (i.e use bundle install --without test development
command)
this mean when use require 'capybara'
command without having gem installed in heroku, you'll end error you've received.
-
sqlite
secondly, you're trying install sqlite gem, not supported heroku.
get rid of sqlite gem production
gem file this:
#gemfile group :development gem 'sqlite' end
this should system install remaining gems working
as mentioned @cupcake
, seems gemfile have sqlite
in development
group - referencing gem gem 'sqlite3-ruby', '1.3.1', :require => 'sqlite3'
-> should placed development
group too:
#gemfile group :development gem 'sqlite3-ruby', '1.3.1', :require => 'sqlite3' end
if apply changes gemfile, should perform following steps:
$ git add . $ git commit -a -m "heroku" $ git push heroku master
Comments
Post a Comment