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

describe 'Fog::AWS::EC2::Volume' do

  describe "#initialize" do

    it "should remap attributes from parser" do
      volume = AWS[:ec2].volumes.new(
        'attachTime'        => 'now',
        'availabilityZone'  => 'us-east-1a',
        'createTime'        => 'recently',
        'instanceId'        => 'i-00000000',
        'snapshotId'        => 'snap-00000000',
        'volumeId'          => 'vol-00000000'
      )
      volume.attached_at.should == 'now'
      volume.availability_zone.should == 'us-east-1a'
      volume.created_at.should == 'recently'
      volume.server_id.should == 'i-00000000'
      volume.snapshot_id.should == 'snap-00000000'
      volume.id.should == 'vol-00000000'
    end

  end

  describe "#collection" do

    it "should return a Fog::AWS::EC2::Volumes" do
      AWS[:ec2].volumes.new.collection.should be_a(Fog::AWS::EC2::Volumes)
    end

    it "should be the volumes the volume is related to" do
      volumes = AWS[:ec2].volumes
      volumes.new.collection.should == volumes
    end

  end

  describe "#destroy" do

    it "should return true if the volume is deleted" do
      volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
      volume.destroy.should be_true
    end

  end

  describe "#server=" do
    before(:all) do
      @server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
      @server.wait_for { ready? }
    end

    after(:all) do
      @server.destroy
    end

    before(:each) do
      @volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
    end

    after(:each) do
      if @volume.id
        @volume.wait_for { state == 'attached' }
        @volume.server = nil<commit_msg>fix the state that is checked for in volume spec<commit_after>require File.dirname(__FILE__) + '/../../../spec_helper'

describe 'Fog::AWS::EC2::Volume' do

  describe "#initialize" do

    it "should remap attributes from parser" do
      volume = AWS[:ec2].volumes.new(
        'attachTime'        => 'now',
        'availabilityZone'  => 'us-east-1a',
        'createTime'        => 'recently',
        'instanceId'        => 'i-00000000',
        'snapshotId'        => 'snap-00000000',
        'volumeId'          => 'vol-00000000'
      )
      volume.attached_at.should == 'now'
      volume.availability_zone.should == 'us-east-1a'
      volume.created_at.should == 'recently'
      volume.server_id.should == 'i-00000000'
      volume.snapshot_id.should == 'snap-00000000'
      volume.id.should == 'vol-00000000'
    end

  end

  describe "#collection" do

    it "should return a Fog::AWS::EC2::Volumes" do
      AWS[:ec2].volumes.new.collection.should be_a(Fog::AWS::EC2::Volumes)
    end

    it "should be the volumes the volume is related to" do
      volumes = AWS[:ec2].volumes
      volumes.new.collection.should == volumes
    end

  end

  describe "#destroy" do

    it "should return true if the volume is deleted" do
      volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
      volume.destroy.should be_true
    end

  end

  describe "#server=" do
    before(:all) do
      @server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
      @server.wait_for { ready? }
    end

    after(:all) do
      @server.destroy
    end

    before(:each) do
      @volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
    end

    after(:each) do
      if @volume.id
        @volume.wait_for { state == 'in-use' }
        @volume.server = nil
{'fraction_non_alphanumeric': 0.14700349368449342, 'fraction_numerical': 0.03439935501209352, 'mean_word_length': 2.5080113100848256, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 12, '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': '6593995', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1200, 'n_words': 270}