<commit_before>require 'spec_helper'

module Overriaktion
  describe Client do 
    subject { Client.instance }

    it "retrieves a list of riak clusters" do 
      stub_request(:get, "http://#{Configuration.api_host}/riak_clusters.json").
        to_return(:status => 200, :body => Responses::JSON::RIAK_CLUSTERS, :headers => {})
      riak_clusters = subject.riak_clusters
      riak_clusters.length.should == 1
      riak_clusters.each { |riak_cluster| riak_cluster.should be_a_kind_of(RiakCluster) }
    end

    it "retrieves information about one riak cluster" do 
      stub_request(:get, "http://#{Configuration.api_host}/riak_clusters/1.json").
        to_return(:status => 200, :body => Responses::JSON::RIAK_CLUSTER, :headers => {})
      riak_cluster = subject.riak_cluster(1)
      riak_cluster.should be_a_kind_of(RiakCluster)
    end

    it "retrieves information about a clusters riak nodes" do 
      stub_request(:get, "http://#{Configuration.api_host}/riak_clusters/1/riak_nodes.json").
        to_return(:status => 200, :body => Responses::JSON::RIAK_NODES, :headers => {})
      riak_nodes = subject.riak_nodes(1)
      riak_nodes.length.should == 1
      riak_nodes.each { |riak_node| riak_node.should be_a_kind_of(RiakNode) }
    end

    it "retrieves information about a clusters single riak node" do
      stub_request(:get, "http://#{Configuration.api_host}/riak_clusters/1/riak_nodes/1.json").
        to_return(:status => 200, :body => Responses::JSON::RIAK_NODE, :headers => {})
      riak_node = subject.riak_node(1, 1)
      riak_node.should be_a_kind_of(RiakNode)
    end
  end
end<commit_msg>use vcr instead of webmock directly.<commit_after>require 'spec_helper'

module Overriaktion
  describe Client do 
    subject { Client.instance }

    it "retrieves a list of riak clusters" do 
      VCR.use_cassette('riak clusters') do
        riak_clusters = subject.riak_clusters
        riak_clusters.length.should == 1
        riak_clusters.each { |riak_cluster| riak_cluster.should be_a_kind_of(RiakCluster) }
      end
    end

    it "retrieves information about one riak cluster" do 
      VCR.use_cassette('riak cluster') do 
        riak_cluster = subject.riak_cluster(1)
        riak_cluster.should be_a_kind_of(RiakCluster)
      end
    end

    it "retrieves information about a clusters riak nodes" do 
      VCR.use_cassette('riak nodes') do 
        riak_nodes = subject.riak_nodes(1)
        riak_nodes.length.should == 1
        riak_nodes.each { |riak_node| riak_node.should be_a_kind_of(RiakNode) }
      end
    end

    it "retrieves information about a clusters single riak node" do
      VCR.use_cassette('riak node') do 
        riak_node = subject.riak_node(1, 1)
        riak_node.should be_a_kind_of(RiakNode)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10336194563662375, 'fraction_numerical': 0.010014306151645207, 'mean_word_length': 3.316358024691358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4024454', 'n_tokens_mistral': 998, 'n_tokens_neox': 965, 'n_words': 198}