Sha256: 88c1e0a4aa2c53fa7a471598b29bb201ad139cfe3f1e2024aa28eb7e9c3745cd

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require "rspec"
require "simplecov"
require "coveralls"
require "codeclimate-test-reporter"
require "vcr"

Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  Coveralls::SimpleCov::Formatter,
  SimpleCov::Formatter::HTMLFormatter,
]

SimpleCov.start

VCR.configure do |c|
  c.cassette_library_dir = __dir__ + '/../fixtures/vcr_cassettes'
  c.hook_into :webmock
  c.ignore_hosts 'codeclimate.com'
  c.configure_rspec_metadata!
end

def underscore s
  s.to_s.scan(/[A-Z][a-z]*/).join("_").downcase
end

def camelize s
  s[0] + s.to_s.split("_").each {|s| s.capitalize! }.join("")[1..-1]
end

def load_fixture subject, version, method
  JSON.parse(File.read(__dir__ + "/fixtures/#{version}/#{method}-#{subject}.json", :encoding => "utf-8"))
end

def expect_init_attribute subject, attribute
  expect(subject.new(camelize(attribute) => "foo").send(attribute)).to eq("foo")
end

def expect_read_only_attribute subject, attribute
  expect { subject.new.send("#{attribute}=".to_sym, "bar") }.to raise_error(NoMethodError)
end

def error_401
  {"status" => {"message" => "Foo", "status_code" => 401}}
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-lol-0.0.6 spec/spec_helper.rb
ruby-lol-0.0.2 spec/spec_helper.rb
ruby-lol-0.0.1 spec/spec_helper.rb