konamio 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9355bbc85a0b405369b30b96176d3275749a69a9
4
- data.tar.gz: c9610b2b28cc66a1f96bce6e0f470422fc80fbff
3
+ metadata.gz: 61fb7a9019c30c5bcd20959e6f143c4f894f926a
4
+ data.tar.gz: 73eec62d88dbc7fe32abb14344e4f028c8347f88
5
5
  SHA512:
6
- metadata.gz: dfcb60568f3c7289ae2eec4b0ac44066e7f80216841fe7bfcef3d91f420910907a8f1ac9dc9b1426f0b2857f52be40d6400adc31e1db034b240e17bad5c4e421
7
- data.tar.gz: d224f73499c5ced6f5e21b6976a667bc09f64792aa619d7fe786906a410ef6242b87f0fc4788220234d69be8c16d1d73d254be64910e04a9e1045c6544ed02c3
6
+ metadata.gz: b72b44f75bbe8ddf1a9943855ea9431d79d68cfa698b63e75e301846e4466919d4ef50122b1a0e53b8317414b808c6d7a1af2cdb09f6ff1e83b650623e9bca01
7
+ data.tar.gz: 73eec1dfe68b4dbd2ac040d475b4eb63d2e44229189bfb8ffacb1f252bb2679ab70d6ba5f9e4bddcf010b550b08812d0a67ab149008592e2a2d29c6861407a28
@@ -7,15 +7,15 @@ Gem::Specification.new do |s|
7
7
  s.version = Konamio::VERSION
8
8
  s.authors = ["Tad Hosford"]
9
9
  s.email = ["tad.hosford@gmail.com"]
10
- s.homepage = "https://rthbound.github.io/konamio"
10
+ s.homepage = "http://ea.rthbound.com/konamio"
11
11
  s.summary = "The Ruby Konami code gem."
12
- s.description = "Tell it which sequence to listen for and what to do when the sequence is received."
12
+ s.description = "Use Konamio in your Ruby or Rails console and be prompted to enter the Konami code. Pass in a block to tell Konamio what to do when the code has been entered. Konamio can optionally be told to listen for any ASCII based sequence (it's not limited to the konami code)."
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test}/*`.split("\n")
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_runtime_dependency "pay_dirt", "1.0.0"
18
+ s.add_runtime_dependency "pay_dirt", "~> 1.0.0"
19
19
  s.add_development_dependency "minitest"
20
20
  s.add_development_dependency "pry"
21
21
  s.add_development_dependency "rake"
@@ -1,3 +1,3 @@
1
1
  module Konamio
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -1,71 +1,140 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  describe Konamio::Sequence::Requisition do
4
- before do
5
- @subject = Konamio::Sequence::Requisition
6
- @options = {
7
- input: @input = MiniTest::Mock.new,
8
- output: @output = MiniTest::Mock.new,
9
- prompt: @prompt = "Foo diddly doobardy party hardy",
10
- listener: @listener = MiniTest::Mock.new,
11
- speaker: @speaker = MiniTest::Mock.new,
12
- sequence: @sequence = ["a"],
13
- confirmation: @confirmation = "Good job, you."
14
- }
15
-
16
- @speaker_instance = MiniTest::Mock.new
17
- @speaker_result = MiniTest::Mock.new
18
- @speaker_instance.expect(:execute!, @speaker_result)
19
- @speaker_instance.expect(:execute!, @speaker_result)
20
-
21
- @listener_instance = MiniTest::Mock.new
22
- @listener_result = MiniTest::Mock.new
23
- @listener_instance.expect(:execute!, @listener_result)
24
- @listener_instance.expect(:execute!, @listener_result)
25
-
26
- @speaker.expect(:new, @speaker_instance, [{ prompt: @prompt, output: @output }])
27
- @listener.expect(:new, @listener_instance, [{ sequence: @sequence, input: @input }])
28
- @data_hash = MiniTest::Mock.new
29
- @listener_result.expect(:data, @data_hash)
30
- @data_hash.expect(:[], ["a"], [:sequence])
31
-
32
- @speaker.expect(:new, @speaker_instance, [{ prompt: @prompt, output: @output }])
33
- @listener.expect(:new, @listener_instance, [{ sequence: @sequence, input: @input }])
34
- @data_hash = MiniTest::Mock.new
35
- @listener_result.expect(:data, @data_hash)
36
- @data_hash.expect(:[], [], [:sequence])
37
-
38
- @speaker_confirmation_instance = MiniTest::Mock.new
39
- @speaker_confirmation_result = MiniTest::Mock.new
40
- @speaker.expect(:new, @speaker_confirmation_instance, [{ prompt: @confirmation, output: @output }])
41
- @speaker_confirmation_instance.expect(:execute!, @speaker_confirmation_result)
42
- end
4
+ describe "when the sequence length is one" do
5
+ before do
6
+ @subject = Konamio::Sequence::Requisition
7
+ @options = {
8
+ input: @input = MiniTest::Mock.new,
9
+ output: @output = MiniTest::Mock.new,
10
+ prompt: @prompt = "Foo diddly doobardy party hardy",
11
+ listener: @listener = MiniTest::Mock.new,
12
+ speaker: @speaker = MiniTest::Mock.new,
13
+ sequence: @sequence = ["a"],
14
+ confirmation: @confirmation = "Good job, you."
15
+ }
43
16
 
44
- it "can be initialized" do
45
- @subject.must_respond_to :new
46
- end
17
+ @speaker_instance = MiniTest::Mock.new
18
+ @speaker_result = MiniTest::Mock.new
19
+ @speaker_instance.expect(:execute!, @speaker_result)
20
+ @speaker_instance.expect(:execute!, @speaker_result)
47
21
 
48
- it "must execute" do
49
- @subject.new(@options).must_respond_to :execute!
50
- end
22
+ @listener_instance = MiniTest::Mock.new
23
+ @listener_result = MiniTest::Mock.new
24
+ @listener_instance.expect(:execute!, @listener_result)
25
+ @listener_instance.expect(:execute!, @listener_result)
51
26
 
52
- it "must return a result object" do
53
- assert @subject.new(@options).execute!.successful?
54
- end
27
+ @speaker.expect(:new, @speaker_instance, [{ prompt: @prompt, output: @output }])
28
+ @listener.expect(:new, @listener_instance, [{ sequence: @sequence, input: @input }])
29
+ @data_hash = MiniTest::Mock.new
30
+ @listener_result.expect(:data, @data_hash)
31
+ @data_hash.expect(:[], ["a"], [:sequence])
32
+
33
+ @speaker.expect(:new, @speaker_instance, [{ prompt: @prompt, output: @output }])
34
+ @listener.expect(:new, @listener_instance, [{ sequence: @sequence, input: @input }])
35
+ @data_hash = MiniTest::Mock.new
36
+ @listener_result.expect(:data, @data_hash)
37
+ @data_hash.expect(:[], [], [:sequence])
38
+
39
+ @speaker_confirmation_instance = MiniTest::Mock.new
40
+ @speaker_confirmation_result = MiniTest::Mock.new
41
+ @speaker.expect(:new, @speaker_confirmation_instance, [{ prompt: @confirmation, output: @output }])
42
+ @speaker_confirmation_instance.expect(:execute!, @speaker_confirmation_result)
43
+ end
44
+
45
+ it "can be initialized" do
46
+ @subject.must_respond_to :new
47
+ end
48
+
49
+ it "must execute" do
50
+ @subject.new(@options).must_respond_to :execute!
51
+ end
52
+
53
+ it "must return a result object" do
54
+ assert @subject.new(@options).execute!.successful?
55
+ end
56
+
57
+ it "will execute a block on success" do
58
+ @block_speaker_instance = MiniTest::Mock.new
59
+ @block_speaker_instance.expect(:execute!, @speaker_result)
60
+ @speaker.expect(:new, @speaker_instance, [{ prompt: "konamio!", output: @output }])
61
+ assert @subject.new(@options).execute! { @speaker.new(prompt: "konamio!", output: @output) }
62
+ end
63
+
64
+ it "will pass the sequence to the block" do
65
+ truth = false
66
+ assert @subject.new(@options).execute! { |seq|
67
+ truth = !truth if @sequence == seq
68
+ }
55
69
 
56
- it "will execute a block on success" do
57
- @block_speaker_instance = MiniTest::Mock.new
58
- @block_speaker_instance.expect(:execute!, @speaker_result)
59
- @speaker.expect(:new, @speaker_instance, [{ prompt: "konamio!", output: @output }])
60
- assert @subject.new(@options).execute! { @speaker.new(prompt: "konamio!", output: @output) }
70
+ assert truth
71
+ end
61
72
  end
73
+ end
74
+
75
+ describe Konamio::Sequence::Requisition do
76
+ describe "when the sequence length is greater than one" do
77
+ before do
78
+ @subject = Konamio::Sequence::Requisition
79
+ @options = {
80
+ input: @input = MiniTest::Mock.new,
81
+ output: @output = MiniTest::Mock.new,
82
+ prompt: @prompt = "Foo diddly doobardy party hardy",
83
+ listener: @listener = MiniTest::Mock.new,
84
+ speaker: @speaker = MiniTest::Mock.new,
85
+ sequence: @sequence = "12",
86
+ confirmation: @confirmation = false
87
+ }
88
+
89
+ @speaker_instance = MiniTest::Mock.new
90
+ @speaker_result = MiniTest::Mock.new
91
+ @speaker_instance.expect(:execute!, @speaker_result)
92
+ @speaker_instance.expect(:execute!, @speaker_result)
93
+
94
+ @listener_instance = MiniTest::Mock.new
95
+ @listener_result = MiniTest::Mock.new
96
+ @listener_instance.expect(:execute!, @listener_result)
97
+ @listener_instance.expect(:execute!, @listener_result)
98
+
99
+ @speaker.expect(:new, @speaker_instance, [{ prompt: @prompt, output: @output }])
100
+ @listener.expect(:new, @listener_instance, [{ sequence: @sequence, input: @input }])
101
+ @data_hash = MiniTest::Mock.new
102
+ @listener_result.expect(:data, @data_hash)
103
+ @data_hash.expect(:[], "2", [:sequence])
104
+
105
+ @speaker.expect(:new, @speaker_instance, [{ prompt: @prompt, output: @output }])
106
+ @listener.expect(:new, @listener_instance, [{ sequence: "2", input: @input }])
107
+ @data_hash = MiniTest::Mock.new
108
+ @listener_result.expect(:data, @data_hash)
109
+ @data_hash.expect(:[], "", [:sequence])
110
+ end
111
+
112
+ it "can be initialized" do
113
+ @subject.must_respond_to :new
114
+ end
115
+
116
+ it "must execute" do
117
+ @subject.new(@options).must_respond_to :execute!
118
+ end
119
+
120
+ it "must return a successful result object" do
121
+ assert @subject.new(@options).execute!.successful?
122
+ end
123
+
124
+ #it "will execute a block on success" do
125
+ # @block_speaker_instance = MiniTest::Mock.new
126
+ # @block_speaker_instance.expect(:execute!, @speaker_result)
127
+ # @speaker.expect(:new, @speaker_instance, [{ prompt: "konamio!", output: @output }])
128
+ # assert @subject.new(@options).execute! { @speaker.new(prompt: "konamio!", output: @output) }
129
+ #end
62
130
 
63
- it "will pass the sequence to the block" do
64
- truth = false
65
- assert @subject.new(@options).execute! { |seq|
66
- truth = !truth if @sequence == seq
67
- }
131
+ #it "will pass the sequence to the block" do
132
+ # truth = false
133
+ # assert @subject.new(@options).execute! { |seq|
134
+ # truth = !truth if @sequence == seq
135
+ # }
68
136
 
69
- assert truth
137
+ # assert truth
138
+ #end
70
139
  end
71
140
  end
@@ -1,8 +1,8 @@
1
1
  # Testing frameworks
2
- #require 'coveralls'
3
- #Coveralls.wear!
4
- require 'simplecov'
5
- SimpleCov.start
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ #require 'simplecov'
5
+ #SimpleCov.start
6
6
 
7
7
  require "minitest/autorun"
8
8
 
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konamio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tad Hosford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-08 00:00:00.000000000 Z
11
+ date: 2013-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pay_dirt
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
@@ -80,8 +80,10 @@ dependencies:
80
80
  - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: Tell it which sequence to listen for and what to do when the sequence
84
- is received.
83
+ description: Use Konamio in your Ruby or Rails console and be prompted to enter the
84
+ Konami code. Pass in a block to tell Konamio what to do when the code has been entered.
85
+ Konamio can optionally be told to listen for any ASCII based sequence (it's not
86
+ limited to the konami code).
85
87
  email:
86
88
  - tad.hosford@gmail.com
87
89
  executables: []
@@ -109,7 +111,7 @@ files:
109
111
  - test/konamio/sequence/requisition_cancelled_test.rb
110
112
  - test/konamio/sequence/requisition_test.rb
111
113
  - test/minitest_helper.rb
112
- homepage: https://rthbound.github.io/konamio
114
+ homepage: http://ea.rthbound.com/konamio
113
115
  licenses: []
114
116
  metadata: {}
115
117
  post_install_message: