Sha256: 439d8fa1d5f49a3b17d72490bdaf9baa0aa880d1358afb1827e11c25d5d09306

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'simplecov'
SimpleCov.start
require "minitest/autorun"
require "webmock/minitest"

require "#{File.dirname(__FILE__)}/../lib/quakelive_api"

def fixtures_path
  "#{File.dirname(__FILE__)}/fixtures"
end

def fixture_profile(name)
  File.read "#{fixtures_path}/profile/#{name}.txt"
end

def fixture_summary(name)
  File.read "#{fixtures_path}/summary/#{name}.txt"
end

def fixture_statistics(name)
  File.read "#{fixtures_path}/statistics/#{name}.txt"
end

def fixture_awards(name)
  File.read "#{fixtures_path}/awards/#{name}.txt"
end

def stub_summary_request(profile_name, content)
  stub_request(:get, "#{QuakeliveApi.site}/profile/summary/#{profile_name}").to_return(content)
end

def stub_stats_request(profile_name, content)
  stub_request(:get, "#{QuakeliveApi.site}/profile/statistics/#{profile_name}").to_return(content)
end

# taken from its-minitest gem, as I'm used to rspec syntax (and it's quite convenient for blackbox testing)
class MiniTest::Spec
  def self.its attribute, &block
    describe "verify subject.#{attribute} for" do
      let(:inner_subject) { subject.send(attribute) }

      it "verify subject.#{attribute} for" do
        inner_subject.instance_eval &block
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quakelive_api-0.0.1 test/test_helper.rb