| |   |
| 1 | require File.dirname(__FILE__) + '/spec_helper' |
| 2 | |
| 3 | describe "Some", Module do |
| 4 | |
| 5 | before(:each) do |
| 6 | @module = Module.new |
| 7 | Module.clear_nsurls |
| 8 | end |
| 9 | |
| 10 | it "should have nil nsurl by default" do |
| 11 | @module.nsurl.should be_nil |
| 12 | end |
| 13 | |
| 14 | it "should be able to change nsurl" do |
| 15 | @module.nsurl 'http://some.url' |
| 16 | @module.nsurl.should == 'http://some.url' |
| 17 | end |
| 18 | |
| 19 | it "should be findable by nsurl" do |
| 20 | @module.nsurl 'http://some.url' |
| 21 | Module.find_by_nsurl(@module.nsurl).should == @module |
| 22 | end |
| 23 | |
| 24 | it "should be able to change nsurl to the same value" do |
| 25 | @module.nsurl 'http://some.url' |
| 26 | lambda { @module.nsurl 'http://some.url' }.should_not raise_error(ArgumentError) |
| 27 | end |
| 28 | |
| 29 | it "should not be able to change nsurl to the value already assigned to some module" do |
| 30 | @some_module = Module.new |
| 31 | @some_module.nsurl 'http://some.url' |
| 32 | lambda { @module.nsurl 'http://some.url' }.should raise_error(ArgumentError) |
| 33 | end |
| 34 | |
| 35 | end |
| 36 | |
| 37 | describe Module do |
| 38 | |
| 39 | |
| 40 | before(:each) do |
| 41 | Module.clear_nsurls |
| 42 | end |
| 43 | |
| 44 | it "should have empty nsurl by default" do |
| 45 | Module.nsurl.should be_empty |
| 46 | end |
| 47 | |
| 48 | end |
| 49 | |
| 50 | describe StrokeDB do |
| 51 | |
| 52 | before(:each) do |
| 53 | Module.clear_nsurls |
| 54 | end |
| 55 | |
| 56 | it "should have #{STROKEDB_NSURL} nsurl by default" do |
| 57 | StrokeDB.nsurl.should == STROKEDB_NSURL |
| 58 | end |
| 59 | |
| 60 | end |
| toggle raw diff |
--- /dev/null
+++ b/spec/lib/strokedb/nsurl_spec.rb
@@ -0,0 +1,60 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "Some", Module do
+
+ before(:each) do
+ @module = Module.new
+ Module.clear_nsurls
+ end
+
+ it "should have nil nsurl by default" do
+ @module.nsurl.should be_nil
+ end
+
+ it "should be able to change nsurl" do
+ @module.nsurl 'http://some.url'
+ @module.nsurl.should == 'http://some.url'
+ end
+
+ it "should be findable by nsurl" do
+ @module.nsurl 'http://some.url'
+ Module.find_by_nsurl(@module.nsurl).should == @module
+ end
+
+ it "should be able to change nsurl to the same value" do
+ @module.nsurl 'http://some.url'
+ lambda { @module.nsurl 'http://some.url' }.should_not raise_error(ArgumentError)
+ end
+
+ it "should not be able to change nsurl to the value already assigned to some module" do
+ @some_module = Module.new
+ @some_module.nsurl 'http://some.url'
+ lambda { @module.nsurl 'http://some.url' }.should raise_error(ArgumentError)
+ end
+
+end
+
+describe Module do
+
+
+ before(:each) do
+ Module.clear_nsurls
+ end
+
+ it "should have empty nsurl by default" do
+ Module.nsurl.should be_empty
+ end
+
+end
+
+describe StrokeDB do
+
+ before(:each) do
+ Module.clear_nsurls
+ end
+
+ it "should have #{STROKEDB_NSURL} nsurl by default" do
+ StrokeDB.nsurl.should == STROKEDB_NSURL
+ end
+
+end
\ No newline at end of file |