Skip to content

Commit

Permalink
simon's edit_link bugfix
Browse files Browse the repository at this point in the history
darcs-hash:20080221041941-ce558-13c3c84da82e2bab5aa0ab8aa2003a2720bb4f53.gz
  • Loading branch information
bct committed Feb 21, 2008
1 parent 553900f commit 91d2f65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/atom/entry.rb
Expand Up @@ -122,7 +122,7 @@ def edit_url
def edit_url=(url)
link = Atom::Link.new({:href => url, :rel => 'edit'})
begin
edit_link = self.links.find { |link| link['rel'] = 'edit' }
edit_link = self.links.find { |link| link['rel'] == 'edit' }
edit_link['href'] = url
rescue
links << link
Expand Down
8 changes: 8 additions & 0 deletions spec/entry_spec.rb
Expand Up @@ -248,6 +248,14 @@
@entry.should be_draft
end

it 'should not erase other link' do
@entry.links.new :rel => 'related', :href => 'http://example.org'

@entry.edit_url = 'http://example.com/entries/foo'
@entry.links.length.should == 2
@entry.links.should include(link)
end

it 'should have APP namespace' do
@entry.draft!
@entry.to_xml.elements['/entry/control/draft'].namespace.should == Atom::PP_NS
Expand Down

0 comments on commit 91d2f65

Please sign in to comment.