<commit_before>require 'spec_helper'

describe HueConference::LightManifest do
  it "should take a Ruhue Client" do
    hue = mock
    ruhue_client = Ruhue::Client.new(hue, "foousername")
    manifest = HueConference::LightManifest.new(ruhue_client)
    manifest.client.should be_a Ruhue::Client
  end

  it "should have a collection of lights" do
    hue = mock
    ruhue_client = Ruhue::Client.new(hue, "foousername")
    manifest = HueConference::LightManifest.new(ruhue_client)
    manifest.lights.should be_a Array
  end

  describe "#build_manifest" do
    let(:hue) { mock }
    let(:ruhue_client) { Ruhue::Client.new(hue, "foousername") }
    let(:manifest) { HueConference::LightManifest.new(ruhue_client) }
    let(:response_data) {
      {
        "1" => { "name" => "Bedroom" },
        "2" => { "name" => "Kitchen" }
      }
    }

    before do
      @response = mock
      @response.stub(:data).and_return(response_data)
      ruhue_client.stub(:get) { @response }
      HueConference::Light.stub(:new) {
        light_stub = mock
        light_stub.stub(:client=)
        light_stub
      }
    end

    it "should return a list of lights" do
      ruhue_client.should_receive(:get).with("/lights")
      manifest.build_manifest
    end

    it "should instantiate lights" do
      HueConference::Light.should_receive(:new).with("1", response_data["1"])<commit_msg>Replace mock w/ double. Deprecation warning<commit_after>require 'spec_helper'

describe HueConference::LightManifest do
  it "should take a Ruhue Client" do
    hue = double
    ruhue_client = Ruhue::Client.new(hue, "foousername")
    manifest = HueConference::LightManifest.new(ruhue_client)
    manifest.client.should be_a Ruhue::Client
  end

  it "should have a collection of lights" do
    hue = double
    ruhue_client = Ruhue::Client.new(hue, "foousername")
    manifest = HueConference::LightManifest.new(ruhue_client)
    manifest.lights.should be_a Array
  end

  describe "#build_manifest" do
    let(:hue) { double }
    let(:ruhue_client) { Ruhue::Client.new(hue, "foousername") }
    let(:manifest) { HueConference::LightManifest.new(ruhue_client) }
    let(:response_data) {
      {
        "1" => { "name" => "Bedroom" },
        "2" => { "name" => "Kitchen" }
      }
    }

    before do
      @response = double
      @response.stub(:data).and_return(response_data)
      ruhue_client.stub(:get) { @response }
      HueConference::Light.stub(:new) {
        light_stub = double
        light_stub.stub(:client=)
        light_stub
      }
    end

    it "should return a list of lights" do
      ruhue_client.should_receive(:get).with("/lights")
      manifest.build_manifest
    end

    it "should instantiate lights" do
      HueConference::Light.should_receive(:new).with("1", response_data["1"])
{'fraction_non_alphanumeric': 0.12491077801570306, 'fraction_numerical': 0.0028551034975017845, 'mean_word_length': 3.2213855421686746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '7241064', 'n_tokens_mistral': 970, 'n_tokens_neox': 965, 'n_words': 184}