<commit_before># encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Middleware::Resource do
  def app
    inner_app = lambda { |env|
      [200, {'Content-Type' => 'text/plain'}, [env['hyperdrive.resource'].name]]
    }
    Hyperdrive::Middleware::Resource.new(inner_app, sample_api.resources.values.first)
  end

  it "adds the requested resource to rack's env" do
    get '/resource'
    last_response.body.must_equal "Thing Resource"
  end
end<commit_msg>create new resource explicitly to fix test isolation issues<commit_after># encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Middleware::Resource do
  before do
    @resource = Hyperdrive::Resource.new(:thing)
  end

  def app
    inner_app = lambda { |env|
      [200, {'Content-Type' => 'text/plain'}, [env['hyperdrive.resource'].namespace]]
    }
    Hyperdrive::Middleware::Resource.new(inner_app, @resource)
  end

  it "adds the requested resource to rack's env" do
    get '/resource'
    last_response.body.must_equal "things"
  end
end
{'fraction_non_alphanumeric': 0.12316715542521994, 'fraction_numerical': 0.007820136852394917, 'mean_word_length': 4.197969543147208, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '663897', 'n_tokens_mistral': 330, 'n_tokens_neox': 316, 'n_words': 83}