Sha256: 1657836a3a0c83edf8c6b4dbe5c66fda8d0da5244efe2a47526171552b1e8ee8

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

ENV["RAILS_ENV"] ||= 'test'
require "canvas_sync"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
# Rails::Generators.invoke("canvas_sync:install", ["--models", "all"], destination_root: Rails.root)
require "bundler/setup"
require 'rspec/rails'
require 'spec_helper'
require 'factory_girl_rails'
require 'timecop'
require 'webmock/rspec'
require 'support/fake_canvas'
require 'shoulda/matchers'
require 'pry'
require 'pry-nav'

require 'sidekiq/testing'
Sidekiq::Testing.fake!

require 'fakeredis/rspec'
Dir[File.dirname(__FILE__) + "/job_batching/support/**/*.rb"].each {|f| require f }

ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
  config.include FactoryGirl::Syntax::Methods
  config.use_transactional_fixtures = true
  config.infer_spec_type_from_file_location!
  config.filter_rails_from_backtrace!

  # Enable flags like --only-failures and --next-failure
  config.example_status_persistence_file_path = ".rspec_status"

  # Disable RSpec exposing methods globally on `Module` and `main`
  config.disable_monkey_patching!

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  config.before(:each) do
    stub_request(:any, /test.instructure.com/).to_rack(FakeCanvas)
  end
end

Shoulda::Matchers.configure do |config|
  config.integrate do |with|
    with.test_framework :rspec
    with.library :rails
  end
end

def open_canvas_fixture(name)
  data = File.open(File.dirname(__FILE__) + '/support/fixtures/canvas_responses/' + name + '.json', 'rb').read
  JSON.parse(data)
end

def canvas_sync_client
  Bearcat::Client.new(token: 'cool-token', prefix: 'http://test.instructure.com')
end

def set_batch_context(ctx)
  allow_any_instance_of(ActiveJob::Base).to receive(:batch_context).and_return(ctx.with_indifferent_access)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
canvas_sync-0.17.0.beta1 spec/spec_helper.rb