Sha256: 7f392c1a4a099eeb0a97df7fc5b0d0372bd76adaca7321488ccb38c923723dc6

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

require 'webmock/rspec'
require 'json'
require 'byebug'
require 'coveralls'
Coveralls::Output.silent = true
Coveralls.wear!

RSpec.configure do |config|
  config.run_all_when_everything_filtered = true
  config.mock_with :mocha
  config.order = 'random'
end

def expect_zendesk(subdomain, endpoint)
  ENV["zendesk_user"] = "foo@bar.com"
  ENV["zendesk_token"] = "123abc"
  crazy_piece = "foo%40bar.com%2Ftoken:123abc"
  stub_request(:get, %r{#{subdomain}.zendesk.com.#{endpoint}})
end

def create_test_file!(temp_file = true)
  datafile = Tempfile.new(["standup", ".json"], File.join(`pwd`.chop, "test")) if temp_file
  datafile ||= File.join(`pwd`.chop, "test", "standup.json")
  stub_filename(datafile)
end

def stub_filename(datafile)
  path = datafile.is_a?(String) ? datafile : datafile.path
  Standupguy::DataMethods.stubs(:filename).returns(path)
  Standupguy::Report.any_instance.stubs(:filename).returns(path)
  Standupguy::Item.any_instance.stubs(:filename).returns(path)
  datafile
end

def expect_datafile(file, pattern)
  data = File.read(file.path)
  expect(data).to match(pattern)
end

def key(date=:today)
  return DateTime.now.strftime("%Y-%m-%d") if date==:today
  return DateTime.strptime(date,"%Y-%m-%d") if date.is_a?(String)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
Standupguy-0.0.10 spec/spec_helper.rb
Standupguy-0.0.9 spec/spec_helper.rb
Standupguy-0.0.8 spec/spec_helper.rb
Standupguy-0.0.6 spec/spec_helper.rb