Permalink
Browse files

adding scope specs

  • Loading branch information...
1 parent f4bd5fa commit 4640b47875135a5166f22fb5ce4e35e3c5f8eea2 @twoism committed Mar 3, 2011
Showing with 32 additions and 2 deletions.
  1. +28 −2 spec/lib/pathy_spec.rb
  2. +4 −0 spec/spec_helper.rb
View
30 spec/lib/pathy_spec.rb
@@ -1,9 +1,33 @@
require 'spec_helper'
describe Pathy do
- before :all do
- Object.pathy!
+ describe "pathy scope" do
+
+ describe "Object.new" do
+ it "should not respond to :has_json_path?" do
+ Object.new.should_not respond_to(:has_json_path?)
+ end
+ end
+
+ describe "SampleClass" do
+ before :all do
+ SampleClass.pathy!
+ end
+
+ it "should not respond to :has_json_path?" do
+ Object.new.should_not respond_to(:has_json_path?)
+ end
+
+ it "should respond to :has_json_path?" do
+ SampleClass.new.should respond_to(:has_json_path?)
+ end
+
+ end
+
+ end
+
+ before :all do
@json = %[
{
@@ -29,6 +53,8 @@
describe "for hashes" do
before :all do
+ Object.pathy!
+
@obj = JSON.parse(@json)
@array = JSON.parse(@json_array)
end
View
4 spec/spec_helper.rb
@@ -2,3 +2,7 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'pathy'
require 'json'
+
+class SampleClass
+
+end

0 comments on commit 4640b47

Please sign in to comment.