- Revision
- 813
- Author
- mauro
- Date
- 2008-09-04 08:17:04 -0500 (Thu, 04 Sep 2008)
Log Message
Moved specs to src/test/ruby/specs directories - as is standard for rspec tests.
Modified Paths
Added Paths
- trunk/examples/jruby-example/src/test/ruby/
- trunk/examples/jruby-example/src/test/ruby/specs/
- trunk/waffle-ruby/src/test/ruby/specs/
- trunk/waffle-ruby/src/test/ruby/specs/org/
- trunk/waffle-ruby/src/test/ruby/specs/org/codehaus/waffle/servlet/waffle_erb_spec.rb
Removed Paths
- trunk/examples/jruby-example/src/test/specs/
- trunk/waffle-ruby/src/test/ruby/org/
- trunk/waffle-ruby/src/test/ruby/specs/org/codehaus/waffle/servlet/erb_extension_spec.rb
Diff
Modified: trunk/.classpath (812 => 813)
--- trunk/.classpath 2008-09-04 08:27:29 UTC (rev 812) +++ trunk/.classpath 2008-09-04 13:17:04 UTC (rev 813) @@ -24,8 +24,9 @@ <classpathentry kind="src" output="examples/simple-example/target/test-classes" path="examples/simple-example/src/test/java"/> <classpathentry kind="src" output="examples/jruby-example/target/classes" path="examples/jruby-example/src/main/java"/> <classpathentry excluding="**" kind="src" output="examples/jruby-example/target/classes" path="examples/jruby-example/src/main/webapp"/> - <classpathentry excluding="**" kind="src" output="examples/jruby-example/target/classes" path="examples/jruby-example/src/main/ruby"/> + <classpathentry kind="src" output="examples/jruby-example/target/classes" path="examples/jruby-example/src/main/ruby"/> <classpathentry kind="src" output="examples/jruby-example/target/test-classes" path="examples/jruby-example/src/test/java"/> + <classpathentry kind="src" output="examples/jruby-example/target/test-classes" path="examples/jruby-example/src/test/ruby"/> <classpathentry kind="src" output="examples/freemarker-example/target/classes" path="examples/freemarker-example/src/main/java"/> <classpathentry excluding="**" kind="src" output="examples/freemarker-example/target/classes" path="examples/freemarker-example/src/main/resources"/> <classpathentry excluding="**" kind="src" output="examples/freemarker-example/target/classes" path="examples/freemarker-example/src/main/webapp"/>
Modified: trunk/examples/jruby-example/pom.xml (812 => 813)
--- trunk/examples/jruby-example/pom.xml 2008-09-04 08:27:29 UTC (rev 812) +++ trunk/examples/jruby-example/pom.xml 2008-09-04 13:17:04 UTC (rev 813) @@ -87,10 +87,9 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>rspec-maven-plugin</artifactId> - <version>1.0-beta-3-SNAPSHOT</version> <configuration> <jrubyHome>${project.build.directory}/jruby/META-INF/jruby.home</jrubyHome> - <sourceDirectory>${basedir}/src/test/specs</sourceDirectory> + <sourceDirectory>${basedir}/src/test/ruby/specs</sourceDirectory> <outputDirectory>${basedir}/target</outputDirectory> <reportFile>${basedir}/target/rspec-report.html</reportFile> <ignoreFailure>false</ignoreFailure>
Copied: trunk/examples/jruby-example/src/test/ruby/specs (from rev 799, trunk/examples/jruby-example/src/test/specs) ( => )
Property changes on: trunk/examples/jruby-example/src/test/ruby/specs ___________________________________________________________________ Name: svn:mergeinfo +
Modified: trunk/waffle-ruby/pom.xml (812 => 813)
--- trunk/waffle-ruby/pom.xml 2008-09-04 08:27:29 UTC (rev 812) +++ trunk/waffle-ruby/pom.xml 2008-09-04 13:17:04 UTC (rev 813) @@ -28,7 +28,7 @@ <build> <resources> <resource> - <directory>src/main/ruby</directory> + <directory>${basedir}/src/main/ruby</directory> <includes> <include>**/*.rb</include> </includes> @@ -36,7 +36,7 @@ </resources> <testResources> <testResource> - <directory>src/test/ruby</directory> + <directory>${basedir}/src/test/ruby</directory> <includes> <include>**/*.rb</include> </includes> @@ -73,7 +73,7 @@ <artifactId>rspec-maven-plugin</artifactId> <configuration> <jrubyHome>${project.build.directory}/jruby/META-INF/jruby.home</jrubyHome> - <sourceDirectory>${basedir}/src/test/ruby</sourceDirectory> + <sourceDirectory>${basedir}/src/test/ruby/specs</sourceDirectory> <outputDirectory>${basedir}/target</outputDirectory> <reportName>rspec-report.html</reportName> <ignoreFailure>false</ignoreFailure>
Copied: trunk/waffle-ruby/src/test/ruby/specs/org (from rev 810, trunk/waffle-ruby/src/test/ruby/org) ( => )
Property changes on: trunk/waffle-ruby/src/test/ruby/specs/org ___________________________________________________________________ Name: svn:mergeinfo +
Deleted: trunk/waffle-ruby/src/test/ruby/specs/org/codehaus/waffle/servlet/erb_extension_spec.rb (810 => 813)
--- trunk/waffle-ruby/src/test/ruby/org/codehaus/waffle/servlet/erb_extension_spec.rb 2008-09-04 08:04:48 UTC (rev 810) +++ trunk/waffle-ruby/src/test/ruby/specs/org/codehaus/waffle/servlet/erb_extension_spec.rb 2008-09-04 13:17:04 UTC (rev 813) @@ -1,68 +0,0 @@ -require 'erb' -require 'org/codehaus/waffle/waffle' -require 'org/codehaus/waffle/erb_extension' -require 'ostruct' - - -describe Waffle::PartialController do - - it "should expose locals as readable attributes" do - controller = Waffle::PartialController.new(Object.new, {:foo => 'bar', :hello => 'world'}) - - controller.foo.should == 'bar' - controller.hello.should == 'world' - - # Ensuring attributes do not propogate to subsequent instances - other = Waffle::PartialController.new(Object.new) - other.should_not respond_to(:foo) - other.should_not respond_to(:bar) - end - - it "should define the same instance variables as the provided delegate controller" do - delegate = Object.new - delegate.instance_variable_set("@foo", 54) - delegate.instance_variable_set("@bar", 99) - - controller = Waffle::PartialController.new(delegate) - controller.instance_variables.should include("@foo") - controller.instance_variables.should include("@bar") - - controller.instance_variable_get("@foo").should == 54 - controller.instance_variable_get("@bar").should == 99 - end - -end - -describe ERB::Util, "partial method" do - - class FakeController - include ERB::Util # Mix-in what's under test - - attr :name - - def initialize - @name = 'waffle' - end - end - - it "should locate file and render through ERB" do - controller = FakeController.new - - File.should_receive(:exist?).with('file path').and_return(true) - Waffle::ScriptLoader.should_receive(:locate_template).with('file name').and_return("file path") - File.should_receive(:open).with('file path').and_return([%{Name: <[EMAIL PROTECTED]> Foo: <%=foo%>}]) - - response = controller.send(:partial, 'file name', {:foo => 'bar'}) - response.should == "Name: waffle Foo: bar" - end - - it "should gracefully handle file does not exist" do - controller = FakeController.new - - Waffle::ScriptLoader.should_receive(:locate_template).with('bad_file.rhtml').and_return("bad file path") - - response = controller.send(:partial, "bad_file.rhtml") - response.should == %Q{File Not Found: Unable to render file 'bad file path'.} - end - -end \ No newline at end of file
Copied: trunk/waffle-ruby/src/test/ruby/specs/org/codehaus/waffle/servlet/waffle_erb_spec.rb (from rev 812, trunk/waffle-ruby/src/test/ruby/org/codehaus/waffle/servlet/waffle_erb_spec.rb) (0 => 813)
--- trunk/waffle-ruby/src/test/ruby/specs/org/codehaus/waffle/servlet/waffle_erb_spec.rb (rev 0) +++ trunk/waffle-ruby/src/test/ruby/specs/org/codehaus/waffle/servlet/waffle_erb_spec.rb 2008-09-04 13:17:04 UTC (rev 813) @@ -0,0 +1,68 @@ +require 'erb' +require 'org/codehaus/waffle/waffle' +require 'org/codehaus/waffle/waffle_erb' +require 'ostruct' + + +describe Waffle::PartialController do + + it "should expose locals as readable attributes" do + controller = Waffle::PartialController.new(Object.new, {:foo => 'bar', :hello => 'world'}) + + controller.foo.should == 'bar' + controller.hello.should == 'world' + + # Ensuring attributes do not propogate to subsequent instances + other = Waffle::PartialController.new(Object.new) + other.should_not respond_to(:foo) + other.should_not respond_to(:bar) + end + + it "should define the same instance variables as the provided delegate controller" do + delegate = Object.new + delegate.instance_variable_set("@foo", 54) + delegate.instance_variable_set("@bar", 99) + + controller = Waffle::PartialController.new(delegate) + controller.instance_variables.should include("@foo") + controller.instance_variables.should include("@bar") + + controller.instance_variable_get("@foo").should == 54 + controller.instance_variable_get("@bar").should == 99 + end + +end + +describe ERB::Util, "partial method" do + + class FakeController + include ERB::Util # Mix-in what's under test + + attr :name + + def initialize + @name = 'waffle' + end + end + + it "should locate file and render through ERB" do + controller = FakeController.new + + File.should_receive(:exist?).with('file path').and_return(true) + Waffle::ScriptLoader.should_receive(:locate_template).with('file name').and_return("file path") + File.should_receive(:open).with('file path').and_return([%{Name: <[EMAIL PROTECTED]> Foo: <%=foo%>}]) + + response = controller.send(:partial, 'file name', {:foo => 'bar'}) + response.should == "Name: waffle Foo: bar" + end + + it "should gracefully handle file does not exist" do + controller = FakeController.new + + Waffle::ScriptLoader.should_receive(:locate_template).with('bad_file.rhtml').and_return("bad file path") + + response = controller.send(:partial, "bad_file.rhtml") + response.should == %Q{File Not Found: Unable to render file 'bad file path'.} + end + +end \ No newline at end of file
To unsubscribe from this list please visit:
