require(File.dirname(__FILE__) + "/../lib/ruby_reads_php") describe "Ruby reads PHP" do describe "reading PHP constants" do it "should read simple constant" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/simple_constant.php") rrp.constants['MY_CONSTANT'].should eql('my value') end it "should read simple constant with double quotes" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/simple_constant_with_double_quotes.php") rrp.constants['MY_CONSTANT'].should eql('my value') end it "should read simple constant with extra spacing" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/simple_constant_with_extra_spacing.php") rrp.constants['MY_CONSTANT'].should eql('my value') end it "should read multiple constants" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/multiple_constants.php") rrp.constants['MY_CONSTANT'].should eql('my value') rrp.constants['MY_CONSTANT_NUMBER_2'].should eql('my value 2') end end describe "opening files" do it "should automatically append .php extension" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/simple_constant") rrp.constants['MY_CONSTANT'].should eql('my value') end end end