Решение на Седма задача от Виктор Хаджипопов

Обратно към всички решения

Към профила на Виктор Хаджипопов

Резултати

  • 0 точки от тестове
  • 0 бонус точки
  • 0 точки общо
  • 0 успешни тест(а)
  • 31 неуспешни тест(а)

Код

module LazyMode
class Date
attr_accessor :year, :month, :day
def initialize(date_string)
if date_string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
year = $1.to_i
month = $2.to_i
day = $3.to_i
end
end
end
class Note
attr_accessor :header, :file_name, :body, :status, :tags
end
def create_file(name)
end
end

Лог от изпълнението

FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Failures:

  1) LazyMode LazyMode::Date can parse year
     Failure/Error: expect(date.year).to eq(2012)
       
       expected: 2012
            got: nil
       
       (compared using ==)
     # /tmp/d20160107-5693-181q0lh/spec.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  2) LazyMode LazyMode::Date can parse month
     Failure/Error: expect(date.month).to eq(10)
       
       expected: 10
            got: nil
       
       (compared using ==)
     # /tmp/d20160107-5693-181q0lh/spec.rb:10:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  3) LazyMode LazyMode::Date can parse day
     Failure/Error: expect(date.day).to eq(3)
       
       expected: 3
            got: nil
       
       (compared using ==)
     # /tmp/d20160107-5693-181q0lh/spec.rb:15:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  4) LazyMode LazyMode::Note has file_name
     Failure/Error: file = LazyMode.create_file('my_todos') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:21:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  5) LazyMode LazyMode::Note has header
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:30:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  6) LazyMode LazyMode::Note can have nested notes
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:99:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  7) LazyMode LazyMode::Note #tags has tags
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:40:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  8) LazyMode LazyMode::Note #tags can have no tags
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:49:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  9) LazyMode LazyMode::Note #status has status
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:60:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  10) LazyMode LazyMode::Note #status can have default status
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:69:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  11) LazyMode LazyMode::Note #body has body
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:80:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  12) LazyMode LazyMode::Note #body can have no body
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:89:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  13) LazyMode#daily_agenda returns note scheduled without repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:120:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  14) LazyMode#daily_agenda returns note scheduled with daily repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:142:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  15) LazyMode#daily_agenda returns note scheduled with weekly repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:164:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  16) LazyMode#daily_agenda returns note scheduled with monthly repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:187:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  17) LazyMode#daily_agenda does not return note whose start date is in the future
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:209:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  18) LazyMode#daily_agenda returns nested notes
     Failure/Error: file = LazyMode.create_file('nesting') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:220:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  19) LazyMode#weekly_agenda returns note scheduled without repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:238:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  20) LazyMode#weekly_agenda returns multiple notes with different dates when scheduled with daily repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:260:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  21) LazyMode#weekly_agenda returns note scheduled with weekly repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:284:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  22) LazyMode#weekly_agenda returns note scheduled with monthly repeater
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:316:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  23) LazyMode#weekly_agenda does not return note whose start date is in the future
     Failure/Error: file = LazyMode.create_file('file') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:338:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  24) LazyMode#weekly_agenda returns nested notes
     Failure/Error: file = LazyMode.create_file('nesting') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:349:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  25) LazyMode#where filters by tag
     Failure/Error: file = LazyMode.create_file('notes') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:367:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  26) LazyMode#where filters by body text
     Failure/Error: file = LazyMode.create_file('notes') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:367:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  27) LazyMode#where filters by header text
     Failure/Error: file = LazyMode.create_file('notes') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:367:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  28) LazyMode#where filters by status
     Failure/Error: file = LazyMode.create_file('notes') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:367:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  29) LazyMode#where filters by multiple filters
     Failure/Error: file = LazyMode.create_file('notes') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:367:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  30) LazyMode.create_file can assign name to files
     Failure/Error: file = LazyMode.create_file('important_notes_and_todos') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:457:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  31) LazyMode.create_file can build notes in the block
     Failure/Error: file = LazyMode.create_file('not_important') do
     NoMethodError:
       undefined method `create_file' for LazyMode:Module
     # /tmp/d20160107-5693-181q0lh/spec.rb:464:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

Finished in 0.01633 seconds
31 examples, 31 failures

Failed examples:

rspec /tmp/d20160107-5693-181q0lh/spec.rb:3 # LazyMode LazyMode::Date can parse year
rspec /tmp/d20160107-5693-181q0lh/spec.rb:8 # LazyMode LazyMode::Date can parse month
rspec /tmp/d20160107-5693-181q0lh/spec.rb:13 # LazyMode LazyMode::Date can parse day
rspec /tmp/d20160107-5693-181q0lh/spec.rb:20 # LazyMode LazyMode::Note has file_name
rspec /tmp/d20160107-5693-181q0lh/spec.rb:29 # LazyMode LazyMode::Note has header
rspec /tmp/d20160107-5693-181q0lh/spec.rb:98 # LazyMode LazyMode::Note can have nested notes
rspec /tmp/d20160107-5693-181q0lh/spec.rb:39 # LazyMode LazyMode::Note #tags has tags
rspec /tmp/d20160107-5693-181q0lh/spec.rb:48 # LazyMode LazyMode::Note #tags can have no tags
rspec /tmp/d20160107-5693-181q0lh/spec.rb:59 # LazyMode LazyMode::Note #status has status
rspec /tmp/d20160107-5693-181q0lh/spec.rb:68 # LazyMode LazyMode::Note #status can have default status
rspec /tmp/d20160107-5693-181q0lh/spec.rb:79 # LazyMode LazyMode::Note #body has body
rspec /tmp/d20160107-5693-181q0lh/spec.rb:88 # LazyMode LazyMode::Note #body can have no body
rspec /tmp/d20160107-5693-181q0lh/spec.rb:119 # LazyMode#daily_agenda returns note scheduled without repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:141 # LazyMode#daily_agenda returns note scheduled with daily repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:163 # LazyMode#daily_agenda returns note scheduled with weekly repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:186 # LazyMode#daily_agenda returns note scheduled with monthly repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:208 # LazyMode#daily_agenda does not return note whose start date is in the future
rspec /tmp/d20160107-5693-181q0lh/spec.rb:219 # LazyMode#daily_agenda returns nested notes
rspec /tmp/d20160107-5693-181q0lh/spec.rb:237 # LazyMode#weekly_agenda returns note scheduled without repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:259 # LazyMode#weekly_agenda returns multiple notes with different dates when scheduled with daily repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:283 # LazyMode#weekly_agenda returns note scheduled with weekly repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:315 # LazyMode#weekly_agenda returns note scheduled with monthly repeater
rspec /tmp/d20160107-5693-181q0lh/spec.rb:337 # LazyMode#weekly_agenda does not return note whose start date is in the future
rspec /tmp/d20160107-5693-181q0lh/spec.rb:348 # LazyMode#weekly_agenda returns nested notes
rspec /tmp/d20160107-5693-181q0lh/spec.rb:390 # LazyMode#where filters by tag
rspec /tmp/d20160107-5693-181q0lh/spec.rb:408 # LazyMode#where filters by body text
rspec /tmp/d20160107-5693-181q0lh/spec.rb:420 # LazyMode#where filters by header text
rspec /tmp/d20160107-5693-181q0lh/spec.rb:432 # LazyMode#where filters by status
rspec /tmp/d20160107-5693-181q0lh/spec.rb:443 # LazyMode#where filters by multiple filters
rspec /tmp/d20160107-5693-181q0lh/spec.rb:456 # LazyMode.create_file can assign name to files
rspec /tmp/d20160107-5693-181q0lh/spec.rb:463 # LazyMode.create_file can build notes in the block

История (1 версия и 0 коментара)

Виктор обнови решението на 21.12.2015 17:20 (преди над 8 години)

+module LazyMode
+ class Date
+ attr_accessor :year, :month, :day
+
+ def initialize(date_string)
+ if date_string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
+ year = $1.to_i
+ month = $2.to_i
+ day = $3.to_i
+ end
+ end
+ end
+
+ class Note
+ attr_accessor :header, :file_name, :body, :status, :tags
+ end
+
+ def create_file(name)
+
+ end
+end