Created
March 14, 2015 04:17
-
-
Save gabeodess/db365fdf5d57ec9109cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$spring rake test test/integration/signup_test.rb | |
Run options: --seed 13906 | |
# Running: | |
#(Element:0x3fe090fae7f8 { | |
name = "a", | |
attributes = [ | |
#(Attr:0x3fe090fae014 { | |
name = "class", | |
value = "btn btn-lg btn-primary btn-block" | |
}), | |
#(Attr:0x3fe090fae550 { name = "data-disable-with", value = "..." }), | |
#(Attr:0x3fe090fae3d4 { name = "data-remote", value = "true" }), | |
#(Attr:0x3fe090faf040 { name = "href", value = "/subscriptions/new" })], | |
children = [ #(Text "Sign me up!")] | |
}) | |
E | |
Finished in 0.746534s, 1.3395 runs/s, 0.0000 assertions/s. | |
1) Error: | |
SignupTest#test_signup: | |
ActionView::MissingTemplate: Missing template subscriptions/new, application/new with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :arb, :jbuilder]}. Searched in: | |
* "/Users/gabeodess/Sites/share_coffee/app/views" | |
* "/Users/gabeodess/.rvm/gems/ruby-2.2.1@ShareCoffee/bundler/gems/activeadmin-c4a21cdcdb2f/app/views" | |
* "/Users/gabeodess/.rvm/gems/ruby-2.2.1@ShareCoffee/gems/kaminari-0.16.3/app/views" | |
* "/Users/gabeodess/.rvm/gems/ruby-2.2.1@ShareCoffee/gems/devise-3.4.1/app/views" | |
test/integration/signup_test.rb:10:in `block in <class:SignupTest>' | |
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class SignupTest < ActionDispatch::IntegrationTest | |
test "signup" do | |
visit(root_path) | |
pp find_link('Sign me up!').native | |
click_link('Sign me up!') | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
require 'mocha/mini_test' | |
require 'sidekiq/testing' | |
require 'assertions' | |
require 'capybara/rails' | |
require 'capybara/poltergeist' | |
Capybara.javascript_driver = :poltergeist | |
pp("Running with DEBUG=#{ENV['DEBUG']}") if ENV['DEBUG'] | |
# Load Stripe stubbing files | |
Dir.glob(File.expand_path(Rails.root.join('test/stubs/stripe/*.rb').to_s, __FILE__)).each do |file| | |
require file | |
end | |
require Rails.root.join('test/webhook_factory.rb').to_s | |
class ActionDispatch::IntegrationTest | |
# Make the Capybara DSL available in all integration tests | |
include Capybara::DSL | |
end | |
class ActionController::TestCase | |
include Devise::TestHelpers | |
end | |
class ActiveSupport::TestCase | |
include ActiveJob::TestHelper | |
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |
fixtures :all | |
# Add more helper methods to be used by all tests here... | |
end | |
# ====================== | |
# = Active Job Helpers = | |
# ====================== | |
def timely_jobs | |
enqueued_jobs.select{ |i| i.performed.blank? and (i.at.blank? or (i.at <= Time.now.to_i)) } | |
end | |
def run_jobs(options = {}) | |
enqueued_jobs.each{ |job| job.reject!{ |k,v| k.to_s == 'at' } } | |
run_timely_jobs(options) | |
end | |
def run_timely_jobs(options = {}) | |
while (jobs = timely_jobs).present? | |
jobs.each do |job| | |
begin | |
job.job.perform_now(*job.args) | |
job['performed'] = true | |
rescue Exception => e | |
job['attempts'] = (job['attempts'] || 0) + 1 | |
job['last_error'] = e | |
job[:at] = 5.minutes.from_now.to_i | |
raise if !options.silence_errors | |
end | |
end | |
self.performed_jobs += enqueued_jobs.select(&:performed) | |
enqueued_jobs.reject!(&:performed) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment