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

テストが落ちる #6

Closed
45deg opened this issue Jun 27, 2015 · 4 comments
Closed

テストが落ちる #6

45deg opened this issue Jun 27, 2015 · 4 comments

Comments

@45deg
Copy link
Owner

45deg commented Jun 27, 2015

RakutenWebService::Books::Genre

RakutenWebService::Books::Genre
  .search
    call the endpoint once (FAILED - 1)
    has interfaces like hash (FAILED - 2)
    has interfaces like hash with snake case key (FAILED - 3)
    has interfaces to get each attribute (FAILED - 4)
  .new
    given a genre id
      only call endpint only at the first time to initialize
  .root
    alias of constructor with the root genre id "000" (FAILED - 5)
  #children
    When get search method
      are Books::Genre objects (FAILED - 6)
    when the genre object has no children information
      call the endpoint to get children (FAILED - 7)
  #search
    if the genre_id starts with "001"
      delegate Books::Book.search (FAILED - 8)
    if the genre_id starts with "002"
      delegate Books::CD.search (FAILED - 9)
    if the genre_id starts with "003"
      delegate Books::DVD.search (FAILED - 10)
    if the genre_id starts with "004"
      delegate Books::Software.search (FAILED - 11)
    if the genre_id starts with "005"
      delegate Books::ForeignBook.search (FAILED - 12)
    if the genre_id starts with "006"
      delegate Books::Game.search (FAILED - 13)
    if the genre_id starts with "007"
      delegate Books::Magazine.search (FAILED - 14)

RakutenWebService::Kobo::Genre

RakutenWebService::Kobo::Genre
  .search
    call the endpoint once (FAILED - 15)
  #search
    Without arguments
      should call RWS::Kobo::Ebook.search with specifying genre id (FAILED - 16)
    With arguments
      should call RWS::Kobo::Ebook.search with given arguments and genre id (FAILED - 17)

Failures:

  1) RakutenWebService::Books::Genre.search call the endpoint once
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  2) RakutenWebService::Books::Genre.search has interfaces like hash
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  3) RakutenWebService::Books::Genre.search has interfaces like hash with snake case key
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  4) RakutenWebService::Books::Genre.search has interfaces to get each attribute
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  5) RakutenWebService::Books::Genre.root alias of constructor with the root genre id "000"
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  6) RakutenWebService::Books::Genre#children When get search method are Books::Genre objects
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  7) RakutenWebService::Books::Genre#children when the genre object has no children information call the endpoint to get children
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  8) RakutenWebService::Books::Genre#search if the genre_id starts with "001" delegate Books::Book.search
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  9) RakutenWebService::Books::Genre#search if the genre_id starts with "002" delegate Books::CD.search
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  10) RakutenWebService::Books::Genre#search if the genre_id starts with "003" delegate Books::DVD.search
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  11) RakutenWebService::Books::Genre#search if the genre_id starts with "004" delegate Books::Software.search
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  12) RakutenWebService::Books::Genre#search if the genre_id starts with "005" delegate Books::ForeignBook.search
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  13) RakutenWebService::Books::Genre#search if the genre_id starts with "006" delegate Books::Game.search
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  14) RakutenWebService::Books::Genre#search if the genre_id starts with "007" delegate Books::Magazine.search
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/books/genre_spec.rb:27:in `block (2 levels) in <top (required)>'

  15) RakutenWebService::Kobo::Genre.search call the endpoint once
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/kobo/genre_spec.rb:23:in `block (2 levels) in <top (required)>'

  16) RakutenWebService::Kobo::Genre#search Without arguments should call RWS::Kobo::Ebook.search with specifying genre id
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/kobo/genre_spec.rb:23:in `block (2 levels) in <top (required)>'

  17) RakutenWebService::Kobo::Genre#search With arguments should call RWS::Kobo::Ebook.search with given arguments and genre id
     Failure/Error: to_return(:body => expected_json)
     WebMock::Response::InvalidBody:
       must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given
     # ./spec/rakuten_web_service/kobo/genre_spec.rb:23:in `block (2 levels) in <top (required)>'
@45deg
Copy link
Owner Author

45deg commented Jun 27, 2015

#7 で部分的な解決

@45deg
Copy link
Owner Author

45deg commented Jun 27, 2015

#8 #9 で解決?
一応全てのテストを通した事にはなるが、本当に合っているのかは不安…

@45deg
Copy link
Owner Author

45deg commented Jun 27, 2015

rspec によるテストを実行した際、17個のサンプルにおいて失敗しました。

80 examples, 17 failures

Failed examples:

rspec ./spec/rakuten_web_service/books/genre_spec.rb:40 # RakutenWebService::Books::Genre.search call the endpoint once
rspec ./spec/rakuten_web_service/books/genre_spec.rb:43 # RakutenWebService::Books::Genre.search has interfaces like hash
rspec ./spec/rakuten_web_service/books/genre_spec.rb:47 # RakutenWebService::Books::Genre.search has interfaces like hash with snake case key
rspec ./spec/rakuten_web_service/books/genre_spec.rb:51 # RakutenWebService::Books::Genre.search has interfaces to get each attribute
rspec ./spec/rakuten_web_service/books/genre_spec.rb:85 # RakutenWebService::Books::Genre.root alias of constructor with the root genre id "000"
rspec ./spec/rakuten_web_service/books/genre_spec.rb:98 # RakutenWebService::Books::Genre#children When get search method are Books::Genre objects
rspec ./spec/rakuten_web_service/books/genre_spec.rb:107 # RakutenWebService::Books::Genre#children when the genre object has no children information call the endpoint to get children
rspec ./spec/rakuten_web_service/books/genre_spec.rb:124 # RakutenWebService::Books::Genre#search if the genre_id starts with "001" delegate Books::Book.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:134 # RakutenWebService::Books::Genre#search if the genre_id starts with "002" delegate Books::CD.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:144 # RakutenWebService::Books::Genre#search if the genre_id starts with "003" delegate Books::DVD.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:154 # RakutenWebService::Books::Genre#search if the genre_id starts with "004" delegate Books::Software.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:164 # RakutenWebService::Books::Genre#search if the genre_id starts with "005" delegate Books::ForeignBook.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:174 # RakutenWebService::Books::Genre#search if the genre_id starts with "006" delegate Books::Game.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:184 # RakutenWebService::Books::Genre#search if the genre_id starts with "007" delegate Books::Magazine.search
rspec ./spec/rakuten_web_service/kobo/genre_spec.rb:36 # RakutenWebService::Kobo::Genre.search call the endpoint once
rspec ./spec/rakuten_web_service/kobo/genre_spec.rb:48 # RakutenWebService::Kobo::Genre#search Without arguments should call RWS::Kobo::Ebook.search with specifying genre id
rspec ./spec/rakuten_web_service/kobo/genre_spec.rb:55 # RakutenWebService::Kobo::Genre#search With arguments should call RWS::Kobo::Ebook.search with given arguments and genre id

該当部分の spec ファイルを調査したところ、webmockの仕様変更により挙動が変わっていたようです( bblimke/webmock#427 )。そのため、specのbefore部分でエラーが発生し、テストに通らないという事態が発生していました。

修正したので、マージをお願いします。

実行環境: ruby 2.2.0p0, webmock 1.21.0

@45deg
Copy link
Owner Author

45deg commented Jun 27, 2015

rspec によるテストを実行した際、17個のサンプルにおいて失敗しました。
実行環境: ruby 2.2.0p0, webmock 1.21.0

80 examples, 17 failures

Failed examples:

rspec ./spec/rakuten_web_service/books/genre_spec.rb:40 # RakutenWebService::Books::Genre.search call the endpoint once
rspec ./spec/rakuten_web_service/books/genre_spec.rb:43 # RakutenWebService::Books::Genre.search has interfaces like hash
rspec ./spec/rakuten_web_service/books/genre_spec.rb:47 # RakutenWebService::Books::Genre.search has interfaces like hash with snake case key
rspec ./spec/rakuten_web_service/books/genre_spec.rb:51 # RakutenWebService::Books::Genre.search has interfaces to get each attribute
rspec ./spec/rakuten_web_service/books/genre_spec.rb:85 # RakutenWebService::Books::Genre.root alias of constructor with the root genre id "000"
rspec ./spec/rakuten_web_service/books/genre_spec.rb:98 # RakutenWebService::Books::Genre#children When get search method are Books::Genre objects
rspec ./spec/rakuten_web_service/books/genre_spec.rb:107 # RakutenWebService::Books::Genre#children when the genre object has no children information call the endpoint to get children
rspec ./spec/rakuten_web_service/books/genre_spec.rb:124 # RakutenWebService::Books::Genre#search if the genre_id starts with "001" delegate Books::Book.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:134 # RakutenWebService::Books::Genre#search if the genre_id starts with "002" delegate Books::CD.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:144 # RakutenWebService::Books::Genre#search if the genre_id starts with "003" delegate Books::DVD.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:154 # RakutenWebService::Books::Genre#search if the genre_id starts with "004" delegate Books::Software.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:164 # RakutenWebService::Books::Genre#search if the genre_id starts with "005" delegate Books::ForeignBook.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:174 # RakutenWebService::Books::Genre#search if the genre_id starts with "006" delegate Books::Game.search
rspec ./spec/rakuten_web_service/books/genre_spec.rb:184 # RakutenWebService::Books::Genre#search if the genre_id starts with "007" delegate Books::Magazine.search
rspec ./spec/rakuten_web_service/kobo/genre_spec.rb:36 # RakutenWebService::Kobo::Genre.search call the endpoint once
rspec ./spec/rakuten_web_service/kobo/genre_spec.rb:48 # RakutenWebService::Kobo::Genre#search Without arguments should call RWS::Kobo::Ebook.search with specifying genre id
rspec ./spec/rakuten_web_service/kobo/genre_spec.rb:55 # RakutenWebService::Kobo::Genre#search With arguments should call RWS::Kobo::Ebook.search with given arguments and genre id

該当部分の spec ファイルを調査したところ、webmockの仕様変更により挙動が変わっていたようです( bblimke/webmock#427 )。そのため、specのbefore部分でエラーが発生し、テストに通らないという事態が発生していました。

修正したので、マージをお願いします。

@45deg 45deg closed this as completed Jun 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant