<commit_before>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe CloudwatchToGraphite::MetricDimension do
  before :each do
    @dimension = CloudwatchToGraphite::MetricDimension.new 'testname', 'testval'
    @valid_string = 'a' * 255
    @invalid_string = 'z' * 256
  end

  describe ".new" do
    it "takes two parameters and returns a MetricDimension" do
      @dimension.should be_an_instance_of CloudwatchToGraphite::MetricDimension
    end
  end

  describe ".create_and_fill" do
    it "should return a MetricDimension" do
      d= CloudwatchToGraphite::MetricDimension.create_and_fill({'name' => 'a', 'value' => 'b'})
      d.should be_an_instance_of CloudwatchToGraphite::MetricDimension
    end
    it "should require valid arguments" do
      expect { CloudwatchToGraphite::MetricDefinition.create_and_fill({'name' => 'blah'}) }.to raise_error(CloudwatchToGraphite::ParseError)
    end
  end

  describe ".Name" do
    it "returns the correct name" do
      @dimension.Name.should eql 'testname'
    end
  end

  describe ".Name=" do
    it "only accepts valid arguments" do
      expect { @dimension.Name = 123 }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
      expect { @dimension.Name = @invalid_string }.to raise_error(CloudwatchToGraphite::ArgumentLengthError)
      @dimension.Name = @valid_string
      @dimension.Name.should eql @valid_string
    end
  end

  describe ".Name" do
    it "returns the correct value" do
      @dimension.Value.should eql 'testval'
    end
  end

  describe ".Value=" do<commit_msg>lame cut and paste fix<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe CloudwatchToGraphite::MetricDimension do
  before :each do
    @dimension = CloudwatchToGraphite::MetricDimension.new 'testname', 'testval'
    @valid_string = 'a' * 255
    @invalid_string = 'z' * 256
  end

  describe ".new" do
    it "takes two parameters and returns a MetricDimension" do
      @dimension.should be_an_instance_of CloudwatchToGraphite::MetricDimension
    end
  end

  describe ".create_and_fill" do
    it "should return a MetricDimension" do
      d= CloudwatchToGraphite::MetricDimension.create_and_fill({'name' => 'a', 'value' => 'b'})
      d.should be_an_instance_of CloudwatchToGraphite::MetricDimension
    end
    it "should require valid arguments" do
      expect { CloudwatchToGraphite::MetricDimension.create_and_fill({'name' => 'blah'}) }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
    end
  end

  describe ".Name" do
    it "returns the correct name" do
      @dimension.Name.should eql 'testname'
    end
  end

  describe ".Name=" do
    it "only accepts valid arguments" do
      expect { @dimension.Name = 123 }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
      expect { @dimension.Name = @invalid_string }.to raise_error(CloudwatchToGraphite::ArgumentLengthError)
      @dimension.Name = @valid_string
      @dimension.Name.should eql @valid_string
    end
  end

  describe ".Name" do
    it "returns the correct value" do
      @dimension.Value.should eql 'testval'
    end
  end

  describe ".Value=" do
{'fraction_non_alphanumeric': 0.098256735340729, 'fraction_numerical': 0.005705229793977813, 'mean_word_length': 3.923556942277691, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7459663', 'n_tokens_mistral': 997, 'n_tokens_neox': 963, 'n_words': 253}