Ruby throws Date::Error on a valid date (DateTime.parse) - ruby

I'm using Ruby's date module to convert/parse my date into a DateTime object. To do this, I'm using DateTime.parse(<time>). But it throws Date::Error even though it's a valid date. Full error message:
2022-07-13 09:54:48 - Date::Error - invalid date:
main.rb:123:in `parse'
main.rb:123:in `block (2 levels) in <main>'
main.rb:121:in `each'
main.rb:121:in `block in <main>'
Code that throws the error:
time = DateTime.parse(client["properties"]["closedate"])

Related

Invalid argument for Chef Directory Resource? Any Ideas why

So, I have the following code which is a ruby block that opens a file on disk and reads each line. Each line is a string that is a dataversion (example: "2020_Q1_NA")
I am reading the file which has a UTF16 BOM encoding, so I open the file with that in mind, and convert each line to UTF-8. Then in the next step, I am creating a directory on D drive for each of the data versions. I am using a Dynamically Created Resource here, because the file I open is actually modified by a powershell_script resource right before the ruby_block resource.
I also tried a non dynamically created directory resource, and that also had the same error, so that isn't the problem
Anyways, I am getting the following error
Errno::EINVAL: directory[d:/Program Files/ALK/data/PCM/2020_Q1_NA
] (dynamically defined) had an error: Errno::EINVAL: Invalid argument - d:/Program Files/ALK/data/PCM/2020_Q1_NA
ruby_block 'get the dataversions and the paths' do
block do
File.open('C:\\deploy\\chefpackages\\alk_pcmworker\\cookbooks\\alk_pcmworker\\dataversions.json', 'rb:BOM|UTF-16LE') do |f|
f.each_line do |line|
dataversion = line.encode("UTF-8", "UTF-16LE")
puts dataversion.encoding # UTF-8
dataversionPath = File.join(node['alk']['dataversions']['datafilesroot'], dataversion)
resource = Chef::Resource::Directory.new(dataversionPath, run_context)
resource.rights(:full_control, 'Administrators', applies_to_children: true)
resource.rights(:read_execute, 'IIS_IUSRS', applies_to_children: true)
resource.recursive(true)
resource.run_action(:create)
end
end
end
action :run
end
I believe it is the dataversion variable that I encoded to UTF-8 that is causing the problem since if I statically set the variable to "2020_Q1_NA", the directory resource will get created, but the encoding is causing some problem, in my findings.
Is there something I am missing and how do I get past this problem. I added the stack trace for the chef recipe as well?
STACKTRACE
Generated at 2021-01-13 09:12:37 -0500
Errno::EINVAL: ruby_block[get the dataversions and the paths] (alk_pcmworker::data_instancestore line 32) had an error: Errno::EINVAL: directory[d:/Program Files/ALK/data/PCM/2020_Q1_NA
] (dynamically defined) had an error: Errno::EINVAL: Invalid argument - d:/Program Files/ALK/data/PCM/2020_Q1_NA
C:/opscode/chef/embedded/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
C:/opscode/chef/embedded/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
C:/opscode/chef/embedded/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
C:/opscode/chef/embedded/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
C:/opscode/chef/embedded/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
C:/opscode/chef/embedded/lib/ruby/2.0.0/fileutils.rb:203:in `each'
C:/opscode/chef/embedded/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider/directory.rb:118:in `block in action_create'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `call'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `add_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider.rb:175:in `converge_by'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider/directory.rb:116:in `action_create'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider.rb:144:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource.rb:596:in `run_action'
C:/Users/Administrator/.chef/local-mode-cache/cache/cookbooks/alk_pcmworker/recipes/data_instancestore.rb:49:in `block (4 levels) in from_file'
C:/Users/Administrator/.chef/local-mode-cache/cache/cookbooks/alk_pcmworker/recipes/data_instancestore.rb:37:in `each_line'
C:/Users/Administrator/.chef/local-mode-cache/cache/cookbooks/alk_pcmworker/recipes/data_instancestore.rb:37:in `block (3 levels) in from_file'
C:/Users/Administrator/.chef/local-mode-cache/cache/cookbooks/alk_pcmworker/recipes/data_instancestore.rb:36:in `open'
C:/Users/Administrator/.chef/local-mode-cache/cache/cookbooks/alk_pcmworker/recipes/data_instancestore.rb:36:in `block (2 levels) in from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider/ruby_block.rb:35:in `call'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider/ruby_block.rb:35:in `block in action_run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `call'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `add_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider.rb:175:in `converge_by'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider/ruby_block.rb:34:in `action_run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/provider.rb:144:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource.rb:596:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/runner.rb:74:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/runner.rb:106:in `block (2 levels) in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/runner.rb:106:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/runner.rb:106:in `block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/runner.rb:105:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/client.rb:658:in `block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/client.rb:653:in `catch'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/client.rb:653:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/client.rb:692:in `converge_and_save'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/client.rb:271:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application.rb:243:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application.rb:220:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application.rb:203:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application/client.rb:413:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application/client.rb:403:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application/client.rb:403:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application/client.rb:393:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.6.0-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:64:in `load'
C:/opscode/chef/bin/chef-client:64:in `<main>'
Right now, I just solved this problem, by just doing the following. After the conversion, I did a inspect on the string and it had special characters, so I just removed them. This isn't the best way probably, but it solved the problem. The issue was special characters that were still there even though the string said it was UTF-8. The directory resource did create the custom folders now!!
dataversion = line.encode("UTF-8", "UTF-16LE")
dataversion = dataversion.inspect
# deleting leftover special characters
dataversion.delete! '"\\\r\\\n'

ArgumentError: invalid date when run minitest through jenkins execute shell

I can run minitest through terminal command, but when I run the same command through jenkins, it throws "ArgumentError: invalid date" on all my test cases. I can't find any solutions from Google. Anyone can help me? And is here the right place to ask these questions?
ruby ../udesk_devops/autotest.rb 'develop' 'daily'
This can run correct through command line.
But will through 'invalid date' through jenkins
And in the process of executing through jenkins, I can see rollback in the log.
It seems the data is trying to go into mysql from fixtures.
Error:
test_问题库分类列表(管理员的问题库)(OpenApiV1::KnowledgeCatalogsControllerTest):
ArgumentError: invalid date
/usr/share/rvm/gems/ruby-2.3.3/gems/timecop-0.8.1/lib/timecop/time_extensions.rb:108:in `parse'
/usr/share/rvm/gems/ruby-2.3.3/gems/timecop-0.8.1/lib/timecop/time_extensions.rb:108:in `parse_with_mock_date'
/usr/share/rvm/gems/ruby-2.3.3/gems/activesupport-4.0.13/lib/active_support/core_ext/string/conversions.rb:53:in `to_datetime'
/usr/share/rvm/gems/ruby-2.3.3/gems/activesupport-4.0.13/lib/active_support/core_ext/date_time/calculations.rb:164:in `<=>'
/usr/share/rvm/gems/ruby-2.3.3/gems/activesupport-4.0.13/lib/active_support/core_ext/time/calculations.rb:286:in `compare_with_coercion'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:570:in `=='
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:570:in `block (2 levels) in table_rows'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:569:in `each'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:569:in `block in table_rows'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:557:in `each'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:557:in `map'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:557:in `table_rows'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:473:in `block (3 levels) in create_fixtures'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:471:in `each'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:471:in `block (2 levels) in create_fixtures'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract/database_statements.rb:203:in `block in transaction'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `within_new_transaction'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract/database_statements.rb:203:in `transaction'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:470:in `block in create_fixtures'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:274:in `disable_referential_integrity'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:457:in `create_fixtures'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:899:in `load_fixtures'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:859:in `setup_fixtures'
/usr/share/rvm/gems/ruby-2.3.3/gems/activerecord-4.0.13/lib/active_record/fixtures.rb:712:in `before_setup'
/var/lib/jenkins/workspace/udesk_proj_week_daily/test/test_helper.rb:35:in `before_setup'

"vagrant up" fails, and error is "invalid byte sequence in Windows-31J (ArgumentError)"

This is the error. Please, does anyone know a solution?
sansontakeshi-no-MacBook-Air:~ yama1223xxx$ vagrant up
/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb:127:in `downcase': invalid byte sequence in Windows-31J (ArgumentError)
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb:127:in `block (2 levels) in fs_real_path'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb:126:in `each'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb:126:in `block in fs_real_path'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb:125:in `each'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb:125:in `fs_real_path'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:118:in `initialize'
from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:157:in `new'
from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:157:in `<main>'
Per this page, consider setting your locale to ja_JP.UTF-8:
$ export LANG=ja_JP.UTF-8

mongoid uninitialized constant CarrierDomain (NameError)

I found another similar question and think I'm following the referenced directions from here but am still coming across this error.
As per the instructions I'm calling Mongoid.load!("path/to/your/mongoid.yml") in my ruby script, so I don't think it's that.
Maybe, as per the error message coming from inflector, it's an issue with how I'm defining CarrierDomain. I'm referencing a rails model from the Sinatra script. It's in a model file called carrier_domain.rb and the class is defined as CarrierDomain (class CarrierDomain). In fact, here is the entire class definition (it's a little one):
class CarrierDomain
include Mongoid::Document
embedded_in :carrier
field :country
field :name
field :prefix, default: ''
end
Here's the error message I'm getting:
/Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize': uninitialized constant CarrierDomain (NameError)
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `constantize'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/metadata.rb:606:in `klass'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/builder.rb:39:in `klass'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/builders/embedded/many.rb:25:in `block in build'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/builders/embedded/many.rb:23:in `each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/builders/embedded/many.rb:23:in `build'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/accessors.rb:43:in `create_relation'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/accessors.rb:26:in `__build__'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/accessors.rb:156:in `block (3 levels) in getter'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/threaded/lifecycle.rb:125:in `_loading'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/accessors.rb:156:in `block (2 levels) in getter'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/threaded/lifecycle.rb:84:in `_building'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/relations/accessors.rb:155:in `block in getter'
from /opt/cmf/app/models/carrier.rb:120:in `to_email_addresses'
from mta_connector.rb:151:in `block in <main>'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/contextual/mongo.rb:645:in `yield_document'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/contextual/mongo.rb:134:in `block (2 levels) in each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/moped-1.2.7/lib/moped/query.rb:78:in `block in each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/moped-1.2.7/lib/moped/cursor.rb:26:in `block in each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/moped-1.2.7/lib/moped/cursor.rb:26:in `each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/moped-1.2.7/lib/moped/cursor.rb:26:in `each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/moped-1.2.7/lib/moped/query.rb:77:in `each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/moped-1.2.7/lib/moped/query.rb:77:in `each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/contextual/mongo.rb:133:in `block in each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/contextual/mongo.rb:604:in `selecting'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/contextual/mongo.rb:132:in `each'
from /Users/arigold/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-3.0.10/lib/mongoid/contextual.rb:18:in `each'
from mta_connector.rb:139:in `<main>'
I had to explicitly require 'carrier_domain' in my Sinatra script.
I had thought that it would know to get the file, since it worked in the rails console (that is, I didn't need to require it in the rails console). Hmm.
Anyhoo, adding require 'carrier_domain' (i.e. the uninitialized constant) to my Sinatra script worked.

when i am fetching date from excel sheet getting errors

When I tried to get date from excel sheet, I get the following error:
undefined method `length' for #<Date: 2011-11-11 (4911753/2,0,2299161)>
C:/ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.3/lib/watir/input_elements.rb:439:
in `limit_to_maxlength'
C:/ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.3/lib/watir/input_elements.rb:412:
in `type_by_character'
C:/ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.3/lib/watir/input_elements.rb:379:
in `set'
profile_check.rb:66:in `test_2'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:695:in `run'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:656:in `block (2 levels) in run_test_
suites'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:650:in `each'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:650:in `block in run_test_suites'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:649:in `each'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:649:in `run_test_suites'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:609:in `run'
C:/ruby192/lib/ruby/1.9.1/minitest/unit.rb:508:in `block in autorun'
How can I resolve this error?
In the excel sheet define that column as text so it will fetch proper date as your web page format.
Because excel sheets have different date format.

Resources