Skip to content

Commit

Permalink
Merge branch 'master' into new-views
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Rashkovskii committed May 4, 2008
2 parents a4f74fd + e88d174 commit cd8a5fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/strokedb/document.rb
Expand Up @@ -269,7 +269,7 @@ def diff(from)
def pretty_print #:nodoc:
slots = to_raw.except('meta')

s = is_a?(ImmutableDocument) ? "#<(imm)" : "#<"
s = is_a?(ImmutableDocument) ? "#<^" : "#<"

Util.catch_circular_reference(self) do
if self[:meta] && name = meta[:name]
Expand Down Expand Up @@ -745,5 +745,9 @@ def mutable?
def save!
self
end

def make_mutable!
unextend(ImmutableDocument)
end
end
end
17 changes: 17 additions & 0 deletions spec/lib/strokedb/document/document_spec.rb
Expand Up @@ -821,6 +821,23 @@
@document.should_not == @another_document
end

end

describe "Immutable Document" do

before(:each) do
setup_default_store
@document = Document.new(:some_data => 1).make_immutable!
@document.should_not be_mutable
end

it "should be able to be mutable again" do
@document.make_mutable!
@document.should be_mutable
end



end

describe "Valid Document's JSON" do
Expand Down

0 comments on commit cd8a5fd

Please sign in to comment.