test/ruby_reads_php.spec in mattfawcett-ruby-reads-php-1.0.0 vs test/ruby_reads_php.spec in mattfawcett-ruby-reads-php-1.1.0

- old
+ new

@@ -20,9 +20,32 @@ 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