Sha256: 6c7da19c12f05249a013fbc6efc52572806d00b8b8ab02b5e685bf490414cb3f
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
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 it "should read slashes" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/simple_constant_with_slashes.php") rrp.constants['MY_CONSTANT'].should eql('http://www.google.com') end it "should cast as integer" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/integer.php") rrp.constants['MY_CONSTANT'].should eql(100) end it "should not cast as integer when quoted" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/integer_quoted.php") rrp.constants['MY_CONSTANT'].should eql("100") end it "should cast as float" do rrp = RubyReadsPHP.read(File.dirname(__FILE__) + "/fixtures/float.php") rrp.constants['MY_CONSTANT'].should eql(95.5.to_f) 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mattfawcett-ruby-reads-php-1.1.0 | test/ruby_reads_php.spec |