Решение на Пета задача от Добромир Иванов
Обратно към всички решения
Към профила на Добромир Иванов
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 18 успешни тест(а)
- 12 неуспешни тест(а)
Код
Лог от изпълнението
.F.FF...FFFF.F.......F...F..FF
Failures:
1) ObjectStore can commit objects
Failure/Error: expect(repo.commit("So cool!")).to be_success("So cool!\n\t2 objects changed", repo.head.result)
expected #<ObjectStore:0x007f6c988ce1a8 @current_branch=#<Branch:0x007f6c988ce0e0 @parent_repo=#<ObjectStore:0x007f6c988ce1a8 ...>, @commits=[#<Commit:0x007f6c988cd960 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>], @name="master", @head=#<Commit:0x007f6c988cd960 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>, @change_count=0, @stage=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>, @branches=[#<Branch:0x007f6c988ce0e0 @parent_repo=#<ObjectStore:0x007f6c988ce1a8 ...>, @commits=[#<Commit:0x007f6c988cd960 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>], @name="master", @head=#<Commit:0x007f6c988cd960 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>, @change_count=0, @stage=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>]> to be success "So cool!\n\t2 objects changed" and #<Commit:0x007f6c988cd960 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>
# /tmp/d20160111-5693-242n79/spec.rb:30:in `block (2 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) ObjectStore can remove objects
Failure/Error: expect(repo.remove("object1")).to be_success("Added object1 for removal.", "content1")
expected #<ObjectStore:0x007f6c988b9578 @current_branch=#<Branch:0x007f6c988ba860 @parent_repo=#<ObjectStore:0x007f6c988b9578 ...>, @commits=[#<Commit:0x007f6c988b3178 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>], @name="master", @head=#<Commit:0x007f6c988b3178 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>, @change_count=1, @stage=[#<struct RepoObject name="object2", object="content2">]>, @branches=[#<Branch:0x007f6c988ba860 @parent_repo=#<ObjectStore:0x007f6c988b9578 ...>, @commits=[#<Commit:0x007f6c988b3178 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>], @name="master", @head=#<Commit:0x007f6c988b3178 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>, @change_count=1, @stage=[#<struct RepoObject name="object2", object="content2">]>]> to be success "Added object1 for removal." and "content1"
# /tmp/d20160111-5693-242n79/spec.rb:43:in `block (2 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) ObjectStore can commit changes which include only removed objects
Failure/Error: expect(repo.commit("Removed object2")).to be_success("Removed object2\n\t1 objects changed", repo.head.result)
expected #<ObjectStore:0x007f6c98898f80 @current_branch=#<Branch:0x007f6c9889a1f0 @parent_repo=#<ObjectStore:0x007f6c98898f80 ...>, @commits=[#<Commit:0x007f6c98896f28 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>, #<Commit:0x007f6c98896bb8 @message="Removed object2", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">]>], @name="master", @head=#<Commit:0x007f6c98896bb8 @message="Removed object2", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">]>, @change_count=0, @stage=[#<struct RepoObject name="object1", object="content1">]>, @branches=[#<Branch:0x007f6c9889a1f0 @parent_repo=#<ObjectStore:0x007f6c98898f80 ...>, @commits=[#<Commit:0x007f6c98896f28 @message="So cool!", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">, #<struct RepoObject name="object2", object="content2">]>, #<Commit:0x007f6c98896bb8 @message="Removed object2", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">]>], @name="master", @head=#<Commit:0x007f6c98896bb8 @message="Removed object2", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">]>, @change_count=0, @stage=[#<struct RepoObject name="object1", object="content1">]>]> to be success "Removed object2\n\t1 objects changed" and #<Commit:0x007f6c98896bb8 @message="Removed object2", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="object1", object="content1">]>
# /tmp/d20160111-5693-242n79/spec.rb:53:in `block (2 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) ObjectStore can show log of changes for a single commit
Failure/Error: commit_hash = Digest::SHA1.hexdigest("#{commit.date.strftime("%a %b %d %H:%M %Y %z")}#{commit.message}")
NoMethodError:
undefined method `date' for nil:NilClass
# /tmp/d20160111-5693-242n79/spec.rb:82:in `block (2 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) ObjectStore can show log of changes for a single commit
Failure/Error: commit_hash = Digest::SHA1.hexdigest("#{commit.date.strftime("%a %b %d %H:%M %Y %z")}#{commit.message}")
NoMethodError:
undefined method `date' for nil:NilClass
# /tmp/d20160111-5693-242n79/spec.rb:91:in `block (2 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) ObjectStore can show log of changes for multiple commits
Failure/Error: commit1_hash = Digest::SHA1.hexdigest("#{commit1.date.strftime(time_format)}#{commit1.message}")
NoMethodError:
undefined method `date' for nil:NilClass
# /tmp/d20160111-5693-242n79/spec.rb:105:in `block (2 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) ObjectStore shows the log for the current branch only
Failure/Error: commit1_hash = Digest::SHA1.hexdigest("#{commit1.date.strftime(time_format)}#{commit1.message}")
NoMethodError:
undefined method `date' for nil:NilClass
# /tmp/d20160111-5693-242n79/spec.rb:126:in `block (2 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) ObjectStore can list branches
Failure/Error: expect(repo.branch.list).to be_success(" develop\n feature\n* master")
expected #<ObjectStore:0x007f6c98827038 @current_branch=#<Branch:0x007f6c98826fc0 @parent_repo=#<ObjectStore:0x007f6c98827038 ...>, @commits=[], @name="master", @head=nil, @change_count=0, @stage=[]>, @branches=[#<Branch:0x007f6c98826fc0 @parent_repo=#<ObjectStore:0x007f6c98827038 ...>, @commits=[], @name="master", @head=nil, @change_count=0, @stage=[]>, #<Branch:0x007f6c98826de0 @parent_repo=#<ObjectStore:0x007f6c98827038 ...>, @commits=[], @name="develop", @head=nil, @change_count=0, @stage=[]>, #<Branch:0x007f6c98826bb0 @parent_repo=#<ObjectStore:0x007f6c98827038 ...>, @commits=[], @name="feature", @head=nil, @change_count=0, @stage=[]>]> to be success " develop\n feature\n* master"
# /tmp/d20160111-5693-242n79/spec.rb:140:in `block (2 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) ObjectStore can be initialized with block
Failure/Error: expect(repo.head).to be_success("Second commit", $second_commit)
NoMethodError:
undefined method `head' for nil:NilClass
# /tmp/d20160111-5693-242n79/spec.rb:195:in `block (2 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) ObjectStore can checkout commits
Failure/Error: expect(repo.checkout(first_commit.hash)).to be_success("HEAD is now at #{first_commit.hash}.", first_commit)
expected #<ObjectStore:0x007f6c9833a200 @current_branch=#<Branch:0x007f6c9833a070 @parent_repo=#<ObjectStore:0x007f6c9833a200 ...>, @commits=[#<Commit:0x007f6c98339440 @message="First commit", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="number", object=42>]>, #<Commit:0x007f6c983388d8 @message="Second commit", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="number", object=21>]>], @name="master", @head=#<Commit:0x007f6c983388d8 @message="Second commit", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="number", object=21>]>, @change_count=0, @stage=[#<struct RepoObject name="number", object=21>]>, @branches=[#<Branch:0x007f6c9833a070 @parent_repo=#<ObjectStore:0x007f6c9833a200 ...>, @commits=[#<Commit:0x007f6c98339440 @message="First commit", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="number", object=42>]>, #<Commit:0x007f6c983388d8 @message="Second commit", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="number", object=21>]>], @name="master", @head=#<Commit:0x007f6c983388d8 @message="Second commit", @date=2016-01-11 11:54:22 +0200, @objects=[#<struct RepoObject name="number", object=21>]>, @change_count=0, @stage=[#<struct RepoObject name="number", object=21>]>]> to be success "HEAD is now at 2115300952265339016." and nil
# /tmp/d20160111-5693-242n79/spec.rb:223:in `block (2 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) ObjectStore can show the objects in a repo after overwriting an object
Failure/Error: expect(first_commit.objects).to match_array(["content1"])
NoMethodError:
undefined method `objects' for nil:NilClass
# /tmp/d20160111-5693-242n79/spec.rb:243:in `block (2 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) ObjectStore can show the objects of a repo after removing an object
Failure/Error: expect(first_commit.objects).to match_array(["content1", "content2", "content3"])
NoMethodError:
undefined method `objects' for nil:NilClass
# /tmp/d20160111-5693-242n79/spec.rb:259:in `block (2 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.02837 seconds
30 examples, 12 failures
Failed examples:
rspec /tmp/d20160111-5693-242n79/spec.rb:26 # ObjectStore can commit objects
rspec /tmp/d20160111-5693-242n79/spec.rb:38 # ObjectStore can remove objects
rspec /tmp/d20160111-5693-242n79/spec.rb:46 # ObjectStore can commit changes which include only removed objects
rspec /tmp/d20160111-5693-242n79/spec.rb:77 # ObjectStore can show log of changes for a single commit
rspec /tmp/d20160111-5693-242n79/spec.rb:86 # ObjectStore can show log of changes for a single commit
rspec /tmp/d20160111-5693-242n79/spec.rb:95 # ObjectStore can show log of changes for multiple commits
rspec /tmp/d20160111-5693-242n79/spec.rb:111 # ObjectStore shows the log for the current branch only
rspec /tmp/d20160111-5693-242n79/spec.rb:136 # ObjectStore can list branches
rspec /tmp/d20160111-5693-242n79/spec.rb:187 # ObjectStore can be initialized with block
rspec /tmp/d20160111-5693-242n79/spec.rb:217 # ObjectStore can checkout commits
rspec /tmp/d20160111-5693-242n79/spec.rb:239 # ObjectStore can show the objects in a repo after overwriting an object
rspec /tmp/d20160111-5693-242n79/spec.rb:253 # ObjectStore can show the objects of a repo after removing an object
История (3 версии и 0 коментара)
Добромир обнови решението на 22.11.2015 10:18 (преди около 9 години)
Добромир обнови решението на 22.11.2015 16:51 (преди около 9 години)
Добромир обнови решението на 22.11.2015 17:36 (преди около 9 години)