Sha256: b49148bc41ac8807bebcd38e4c4430fbdc1612b9d585703150a81c090df06cb1

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 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
	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.0.0 test/ruby_reads_php.spec