Sha256: b8df6db2b6c8bb7eaaab195f9bc4533a81c4195e78e1e9750b88af423ea860f5

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

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

describe Revenc::Errors do

  before(:each) do
    @error_obj = Revenc::Errors.new
  end

  it "should be empty when created" do
    @error_obj.should be_empty
  end

  it "should return a count of the errors" do
    @error_obj.should be_empty
    @error_obj.add(:test_error1)
    @error_obj.add(:test_error2)
    @error_obj.should_not be_empty
    @error_obj.size.should == 2
  end

  it "should clear the errors" do
    @error_obj.should be_empty
    @error_obj.add(:test_error1)
    @error_obj.add(:test_error2)
    @error_obj.should_not be_empty
    @error_obj.size.should be(2)
    @error_obj.clear
    @error_obj.should be_empty
    @error_obj.size.should be(0)
  end

  it "should return the errors in full sentences for errors on symbol" do
    @error_obj.should be_empty
    @error_obj.add(:test_error1, "Error no 1")
    @error_obj.add(:test_error2, "Error no 2")
    @error_obj.size.should be(2)
    @error_obj.to_sentences.should == "test error1 Error no 1\ntest error2 Error no 2"
  end

  it "should return the errors in full sentences for errors on class names" do
    @error_obj.should be_empty
    @error_obj.add(@error_obj, "error no 1")
    @error_obj.add(@error_obj, "error no 2")
    @error_obj.size.should be(2)
    @error_obj.to_sentences.should == "errors error no 1\nerrors error no 2"
  end

end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
revenc-0.2.1 spec/revenc/error_spec.rb