examples/lib/micronaut/behaviour_example.rb in spicycode-micronaut-0.1.6.9 vs examples/lib/micronaut/behaviour_example.rb in spicycode-micronaut-0.1.6.9.1

- old
+ new

@@ -57,9 +57,36 @@ it "should add the third parameter to the metadata" do Micronaut::Behaviour.describe(Object, nil, 'foo' => 'bar') { }.metadata.should include({ "foo" => 'bar' }) end + it "should add the file_path_with_line_number of the current behaviour to metadata" do + Micronaut::Behaviour.describe(Object) { }.metadata[:behaviour][:file_path_with_line_number].should == "#{__FILE__}:#{__LINE__}" + end + + it "should add the the file_path of the current behaviour to metadata" do + Micronaut::Behaviour.describe(Object) { }.metadata[:behaviour][:file_path].should == "#{__FILE__}" + end + + it "should add a reader for file_path to the behaviour for easy access" do + Micronaut::Behaviour.describe(Object) { }.file_path.should == "#{__FILE__}" + end + + it "should add the line_number of the current behavior to metadata" do + Micronaut::Behaviour.describe(Object) { }.metadata[:behaviour][:line_number].should == __LINE__ + end + + it "should add file path and line number metadata for arbitrarily nested describes" do + Micronaut::Behaviour.describe(Object) do + Micronaut::Behaviour.describe("foo") do + + Micronaut::Behaviour.describe(Object) { }.metadata[:behaviour][:file_path_with_line_number].should == "#{__FILE__}:#{__LINE__}" + Micronaut::Behaviour.describe(Object) { }.metadata[:behaviour][:line_number].should == __LINE__ + + end + end + end + end describe "adding before and after hooks" do it "should expose the before each blocks at before_eachs" do \ No newline at end of file