Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Book.add_item fails with exception if media_type or media_overlay is passed #109

Closed
slonopotamus opened this issue Feb 15, 2020 · 0 comments
Assignees

Comments

@slonopotamus
Copy link
Contributor

slonopotamus commented Feb 15, 2020

Test case:

    describe 'add_item' do
      it 'adds item with media type' do
        book = GEPUB::Book.new
        book.add_item 'chap3.xml', content: nil, media_type: 'application/docbook+xml'
        expect(book.items.size).to eq 1
      end
    end

Expected: test passes

Actual:

     NoMethodError:
       undefined method `add_media_type' for #<GEPUB::Item:0x0000000006d80a58>
     # ./lib/gepub/book.rb:474:in `block in add_item_internal'
     # ./lib/gepub/book.rb:467:in `each'
     # ./lib/gepub/book.rb:467:in `add_item_internal'
     # ./lib/gepub/book_add_item.rb:9:in `add_item'
     # ./spec/book_spec.rb:277:in `block (4 levels) in <top (required)>'

Same bug happens with Book.add_ordered_item.

Workaround:

item = book.add_item 'chap3.xml', content: nil
item.set_media_type: 'application/docbook+xml'
@slonopotamus slonopotamus changed the title Book.add_item fails with exception if media_type or media_overlay argument is passed Book.add_item fails with exception if media_type or media_overlay is passed Feb 15, 2020
@skoji skoji self-assigned this Feb 17, 2020
@skoji skoji closed this as completed in 5841a9a Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants