1 require File.dirname(__FILE__) + '/../../spec_helper'
4 # These specs are difficult because the values may vary
5 # depending on platform or other configuration options.
6 # However, the specs are valuable in that they will ensure
7 # that rbconfig loads and contains required values.
9 # The Config entries fall into two general categories:
10 # 1) the static-value entries; and 2) the configured-
11 # value entries. For the second one, the specs check
12 # only for the existence of a key.
14 def it_has_keys(name, keys)
17 @const = const_lookup name
21 it "has key #{key}" do
22 @const.key?(key).should_not be_nil
28 def it_has_entries(name, entries)
31 @const = const_lookup name
34 entries.each do |key, expected|
35 it "has entry #{key} == #{expected}" do
36 @const[key].should == expected
42 describe "RbConfig" do
43 it "is equal to Config" do
44 RbConfig.should eql(Config)
48 # TODO: many more specs needed
49 describe "Config::CONFIG" do
63 it_has_keys 'Config::CONFIG', keys
66 "RUBY_SO_NAME" => "rubinius-0.9.0",
67 "ruby_install_name" => "rbx",
68 "ruby_version" => "1.8",
71 it_has_entries 'Config::CONFIG', entries
74 describe "Config::MAKEFILE_CONFIG" do
76 "exec_prefix" => "$(prefix)",
77 "bindir" => "$(exec_prefix)/bin",
78 "sbindir" => "$(exec_prefix)/sbin",
79 "libexecdir" => "$(exec_prefix)/libexec",
80 "datarootdir" => "$(prefix)/share",
81 "datadir" => "$(datarootdir)",
82 "sysconfdir" => "$(prefix)/etc",
83 "sharedstatedir" => "$(prefix)/com",
84 "localstatedir" => "$(prefix)/var",
85 "includedir" => "$(prefix)/include",
86 "oldincludedir" => "/usr/include",
87 "docdir" => "$(datarootdir)/doc/$(PACKAGE)",
88 "infodir" => "$(datarootdir)/info",
89 "htmldir" => "$(docdir)",
90 "dvidir" => "$(docdir)",
91 "pdfdir" => "$(docdir)",
92 "psdir" => "$(docdir)",
93 "libdir" => "$(exec_prefix)/lib",
94 "localedir" => "$(datarootdir)/locale",
95 "mandir" => "$(datarootdir)/man",
96 "sitedir" => "$(libdir)/ruby/site_ruby",
97 "ruby_version" => "$(MAJOR).$(MINOR)",
98 "rubylibdir" => "$(libdir)/ruby/$(ruby_version)",
99 "archdir" => "$(rubylibdir)/$(arch)",
100 "sitearchdir" => "$(sitelibdir)/$(sitearch)",
101 "sitedir" => "$(install_prefix)/lib/rubinius",
102 "rubyhdrdir" => "$(prefix)/shotgun/lib/subtend"
105 it_has_entries 'Config::MAKEFILE_CONFIG', entries