pork 0.9.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+
2
+ require 'pork/auto'
3
+
4
+ describe Pork::Inspect do
5
+ would 'hash' do
6
+ Pork::Inspect.with_auto(
7
+ {:b => 1, :a => 0}, :==, [{:a => 1, :b => 0}], false).
8
+ should.eq '{:a=>0, :b=>1}.==({:a=>1, :b=>0}) to return true'
9
+ end
10
+
11
+ would 'newline' do
12
+ obj, arg = 'a'*80, 'b'*80
13
+ Pork::Inspect.with_auto(obj, :==, [arg], true).
14
+ should.eq "\n#{obj.inspect}.==(\n#{arg.inspect}) to return false"
15
+ end
16
+
17
+ would 'diff' do
18
+ s = File.read(__FILE__)
19
+ n = s.count("\n")
20
+ Pork::Inspect.with_auto(s, :==, ["#{s}b\n"], true).
21
+ should.eq "String#==(\n#{n}a#{n+1}\n> b\n) to return false"
22
+ end
23
+
24
+ would '#diff_hash' do
25
+ a = {"category_chats"=>[{"category_name"=>"Cat", "experts_url"=>"cat-experts", "chat_list"=>[{"mentee"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "mentor"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"menmen", "name"=>"Menmen", "level"=>"mentor", "rating"=>0.0, "role"=>"mentor", "avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}]}], "longterm"=>[{"rate"=>"3.00", "credit"=>"7.00", "valid_from"=>1416148781, "valid_to"=>1416235181, "mentee"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "mentor"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"menmen", "name"=>"Menmen", "level"=>"mentor", "rating"=>0.0, "role"=>"mentor", "avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}], "my"=>[], "recent_chats"=>[{"request"=>{}, "type"=>"message", "id"=>"e71bca4b-a617-4edc-9816-7fc3034c64ea", "content"=>"hi", "created_at"=>"2014-11-16T14:39:41Z", "read_at"=>nil, "sender"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "receiver"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"menmen", "name"=>"Menmen", "level"=>"mentor", "rating"=>0.0, "role"=>"mentor", "avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}]}
26
+
27
+ b = {"category_chats"=>[{"category_name"=>"Cat", "experts_url"=>"cat-experts", "chat_list"=>[{"mentee"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}]}], "longterm"=>[{"rate"=>"3.00", "credit"=>"7.00", "valid_from"=>1416148781, "valid_to"=>1416235181, "mentee"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "mentor"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"menmen", "name"=>"Menmen", "level"=>"mentor", "rating"=>0.0, "role"=>"mentor", "avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}], "my"=>[{"mentee"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}], "recent_chats"=>[{"request"=>{}, "type"=>"message", "id"=>"e71bca4b-a617-4edc-9816-7fc3034c64ea", "content"=>"hi", "created_at"=>"2014-11-16T14:39:41Z", "read_at"=>nil, "sender"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "receiver"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"menmen", "name"=>"Menmen", "level"=>"mentor", "rating"=>0.0, "role"=>"mentor", "avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}]}
28
+
29
+ f = expect.raise(Pork::Failure){ expect(a, 'Additional Message').eq(b) }
30
+ expect(f.message).eq <<-MSG.sub(/\AExpect/, 'Expect ').chop
31
+ Expect
32
+ \tHash with key path: "category_chats:0:chat_list:0:mentor"
33
+ nil.==({"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"menmen", "name"=>"Menmen", "level"=>"mentor", "rating"=>0.0, "role"=>"mentor", "avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/556611444ab1143c8ad30206fda3926f?d=mm?s=64&d=mm"}) to return true
34
+
35
+ \tHash with key path: "my:0"
36
+ {"mentee"=>{"timezone_str"=>"+00:00", "timezone_offset"=>0, "timezone_display"=>"UTC (+00:00)", "username"=>"example", "name"=>"Example", "level"=>"mentor", "rating"=>0.0, "role"=>"user", "avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm", "small_avatar_url"=>"https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=mm?s=64&d=mm"}, "chatroom_id"=>"8c3dd9387dd30499a4053e07e4a41be4", "chatroom_firebase_id"=>"49c31f7444e199bdaea610dbe518d329"}.==(
37
+ nil) to return true
38
+ Additional Message
39
+ MSG
40
+ end
41
+ end
@@ -0,0 +1,13 @@
1
+
2
+ require 'pork/auto'
3
+ require 'pork/isolate'
4
+
5
+ describe Pork::Isolate do
6
+ would '#isolate' do
7
+ Pork::Executor.all_tests.each_key do |name|
8
+ next ok if name.start_with?('Pork::Isolate #isolate #')
9
+ stat = Pork::Executor.isolate(name, pork_stat)
10
+ expect(stat.passed?, stat.inspect).eq true
11
+ end
12
+ end
13
+ end
data/test/test_nested.rb CHANGED
@@ -60,27 +60,6 @@ would 'also work on top-level' do
60
60
  true.should.eq true
61
61
  end
62
62
 
63
- describe 'Pork.inspect_failure' do
64
- would 'hash' do
65
- Pork.inspect_failure_auto(
66
- {:b => 1, :a => 0}, :==, [{:a => 1, :b => 0}], false).
67
- should.eq '{:a=>0, :b=>1}.==({:a=>1, :b=>0}) to return true'
68
- end
69
-
70
- would 'newline' do
71
- obj, arg = 'a'*80, 'b'*80
72
- Pork.inspect_failure_auto(obj, :==, [arg], true).
73
- should.eq "\n#{obj.inspect}.==(\n#{arg.inspect}) to return false"
74
- end
75
-
76
- would 'diff' do
77
- s = File.read(__FILE__)
78
- n = s.count("\n")
79
- Pork.inspect_failure_auto(s, :==, ["#{s}b\n"], true).
80
- should.eq "String#==(\n#{n}a#{n+1}\n> b\n) to return false"
81
- end
82
- end
83
-
84
63
  describe 'should(message)' do
85
64
  would 'show message' do
86
65
  should.raise(Pork::Failure){ should('nnf').satisfy('qoo'){ false } }.
@@ -0,0 +1,12 @@
1
+
2
+ require 'pork/test'
3
+ require 'pork/mode/parallel'
4
+
5
+ describe Pork::Parallel do
6
+ paste
7
+
8
+ would '#parallel' do
9
+ stat = Pork::Executor.parallel(8, pork_stat)
10
+ expect(stat.passed?, stat.inspect).eq true
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+
2
+ require 'pork/test'
3
+ require 'pork/mode/shuffle'
4
+
5
+ describe Pork::Shuffle do
6
+ paste
7
+
8
+ would '#shuffle' do
9
+ stat = Pork::Executor.shuffle(pork_stat)
10
+ expect(stat.passed?, stat.inspect).eq true
11
+ end
12
+ end
metadata CHANGED
@@ -1,19 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-07 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: muack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: |-
14
28
  Pork -- Simple and clean and modular testing library.
15
29
 
16
- [Bacon][] reimplemented around 250 lines of code.
30
+ Inspired by [Bacon][].
17
31
 
18
32
  [Bacon]: https://github.com/chneukirchen/bacon
19
33
  email:
@@ -26,18 +40,37 @@ files:
26
40
  - ".gitmodules"
27
41
  - ".travis.yml"
28
42
  - CHANGES.md
43
+ - Gemfile
29
44
  - LICENSE
30
45
  - README.md
31
46
  - Rakefile
47
+ - lib/mutant/integration/pork.rb
32
48
  - lib/pork.rb
33
49
  - lib/pork/auto.rb
50
+ - lib/pork/context.rb
51
+ - lib/pork/env.rb
52
+ - lib/pork/error.rb
53
+ - lib/pork/executor.rb
54
+ - lib/pork/expect.rb
55
+ - lib/pork/imp.rb
56
+ - lib/pork/inspect.rb
57
+ - lib/pork/isolate.rb
58
+ - lib/pork/mode/parallel.rb
59
+ - lib/pork/mode/shuffle.rb
60
+ - lib/pork/should.rb
61
+ - lib/pork/stat.rb
62
+ - lib/pork/test.rb
34
63
  - lib/pork/version.rb
35
64
  - pork.gemspec
36
65
  - task/README.md
37
66
  - task/gemgem.rb
38
67
  - test/test_bacon.rb
68
+ - test/test_inspect.rb
69
+ - test/test_isolate.rb
39
70
  - test/test_nested.rb
71
+ - test/test_parallel.rb
40
72
  - test/test_readme.rb
73
+ - test/test_shuffle.rb
41
74
  homepage: https://github.com/godfat/pork
42
75
  licenses:
43
76
  - Apache License 2.0
@@ -58,11 +91,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
91
  version: '0'
59
92
  requirements: []
60
93
  rubyforge_project:
61
- rubygems_version: 2.4.2
94
+ rubygems_version: 2.4.4
62
95
  signing_key:
63
96
  specification_version: 4
64
97
  summary: Pork -- Simple and clean and modular testing library.
65
98
  test_files:
66
99
  - test/test_bacon.rb
100
+ - test/test_inspect.rb
101
+ - test/test_isolate.rb
67
102
  - test/test_nested.rb
103
+ - test/test_parallel.rb
68
104
  - test/test_readme.rb
105
+ - test/test_shuffle.rb