pupa 0.1.11 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/.yardopts +0 -1
- data/Gemfile +1 -3
- data/LICENSE +1 -1
- data/PERFORMANCE.md +1 -1
- data/README.md +19 -23
- data/Rakefile +2 -2
- data/lib/pupa.rb +0 -1
- data/lib/pupa/models/concerns/timestamps.rb +1 -1
- data/lib/pupa/processor/connection.rb +1 -1
- data/lib/pupa/processor/connection_adapters/mongodb_adapter.rb +5 -5
- data/lib/pupa/processor/connection_adapters/postgresql_adapter.rb +1 -1
- data/lib/pupa/processor/document_store/file_store.rb +2 -0
- data/lib/pupa/refinements/faraday_middleware.rb +3 -1
- data/lib/pupa/version.rb +1 -1
- data/pupa.gemspec +9 -9
- data/spec/models/area_spec.rb +1 -1
- data/spec/models/concerns/contactable_spec.rb +8 -8
- data/spec/models/concerns/identifiable_spec.rb +7 -7
- data/spec/models/concerns/linkable_spec.rb +3 -3
- data/spec/models/concerns/nameable_spec.rb +3 -3
- data/spec/models/concerns/sourceable_spec.rb +3 -3
- data/spec/models/concerns/timestamps_spec.rb +4 -4
- data/spec/models/contact_detail_list_spec.rb +6 -6
- data/spec/models/identifier_list_spec.rb +2 -2
- data/spec/models/membership_spec.rb +3 -3
- data/spec/models/model_spec.rb +32 -32
- data/spec/models/motion_spec.rb +1 -1
- data/spec/models/organization_spec.rb +3 -3
- data/spec/models/person_spec.rb +3 -3
- data/spec/models/post_spec.rb +2 -2
- data/spec/models/vote_event_spec.rb +8 -8
- data/spec/models/vote_spec.rb +1 -1
- data/spec/processor/client_spec.rb +4 -4
- data/spec/processor/connection_adapters/mongodb_adapter_spec.rb +8 -8
- data/spec/processor/connection_adapters/postgresql_adapter_spec.rb +1 -62
- data/spec/processor/connection_adapters/sqlite_adapter_spec.rb +5 -0
- data/spec/processor/connection_spec.rb +2 -2
- data/spec/processor/document_store/file_store_spec.rb +19 -19
- data/spec/processor/document_store/redis_store_spec.rb +18 -18
- data/spec/processor/document_store_spec.rb +2 -2
- data/spec/processor/middleware/logger_spec.rb +7 -7
- data/spec/processor/middleware/parse_json_spec.rb +1 -1
- data/spec/processor/yielder_spec.rb +4 -4
- data/spec/processor_spec.rb +41 -41
- data/spec/runner_spec.rb +9 -9
- data/spec/spec_helper.rb +9 -1
- data/spec/support/shared_examples_for_connection_adapters.rb +66 -0
- metadata +38 -35
- data/USAGE +0 -1
data/spec/models/vote_spec.rb
CHANGED
@@ -3,13 +3,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe Pupa::Processor::Client do
|
4
4
|
describe '.new' do
|
5
5
|
it 'should use the filesystem' do
|
6
|
-
ActiveSupport::Cache::FileStore.
|
7
|
-
Pupa::Processor::Client.new(cache_dir: '/tmp', level: 'UNKNOWN').get('http://
|
6
|
+
expect(ActiveSupport::Cache::FileStore).to receive(:new).and_call_original
|
7
|
+
Pupa::Processor::Client.new(cache_dir: '/tmp', level: 'UNKNOWN').get('http://httpbin.org/')
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should use Memcached' do
|
11
|
-
ActiveSupport::Cache::MemCacheStore.
|
12
|
-
Pupa::Processor::Client.new(cache_dir: 'memcached://localhost', level: 'UNKNOWN').get('http://
|
11
|
+
expect(ActiveSupport::Cache::MemCacheStore).to receive(:new).and_call_original
|
12
|
+
Pupa::Processor::Client.new(cache_dir: 'memcached://localhost', level: 'UNKNOWN').get('http://httpbin.org/')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -13,8 +13,8 @@ describe Pupa::Processor::Connection::MongoDBAdapter do
|
|
13
13
|
connection.raw_connection[:people].drop
|
14
14
|
|
15
15
|
connection.save(Pupa::Person.new(_id: 'existing', name: 'existing', email: 'existing@example.com'))
|
16
|
-
connection.raw_connection[:people].
|
17
|
-
connection.raw_connection[:people].
|
16
|
+
connection.raw_connection[:people].insert_one(_type: 'pupa/person', name: 'non-unique')
|
17
|
+
connection.raw_connection[:people].insert_one(_type: 'pupa/person', name: 'non-unique')
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '.find' do
|
@@ -23,11 +23,11 @@ describe Pupa::Processor::Connection::MongoDBAdapter do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should return nil if no matches' do
|
26
|
-
connection.find(_type: _type, name: 'nonexistent').
|
26
|
+
expect(connection.find(_type: _type, name: 'nonexistent')).to eq(nil)
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should return a document if one match' do
|
30
|
-
connection.find(_type: _type, name: 'existing').
|
30
|
+
expect(connection.find(_type: _type, name: 'existing')).to be_a(Hash)
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should raise an error if many matches' do
|
@@ -41,13 +41,13 @@ describe Pupa::Processor::Connection::MongoDBAdapter do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should insert a document if no matches' do
|
44
|
-
connection.save(Pupa::Person.new(_id: 'new', name: 'new', email: 'new@example.com')).
|
45
|
-
connection.find(_type: _type, name: 'new')['email'].
|
44
|
+
expect(connection.save(Pupa::Person.new(_id: 'new', name: 'new', email: 'new@example.com'))).to eq([true, 'new'])
|
45
|
+
expect(connection.find(_type: _type, name: 'new')['email']).to eq('new@example.com')
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should update a document if one match' do
|
49
|
-
connection.save(Pupa::Person.new(_id: 'changed', name: 'existing', email: 'changed@example.com')).
|
50
|
-
connection.find(_type: _type, name: 'existing')['email'].
|
49
|
+
expect(connection.save(Pupa::Person.new(_id: 'changed', name: 'existing', email: 'changed@example.com'))).to eq([false, 'existing'])
|
50
|
+
expect(connection.find(_type: _type, name: 'existing')['email']).to eq('changed@example.com')
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should raise an error if many matches' do
|
@@ -1,66 +1,5 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
3
|
describe Pupa::Processor::Connection::PostgreSQLAdapter do
|
4
|
-
|
5
|
-
'pupa/person'
|
6
|
-
end
|
7
|
-
|
8
|
-
def connection
|
9
|
-
Pupa::Processor::Connection::PostgreSQLAdapter.new('postgres://localhost:5432/pupa_test')
|
10
|
-
end
|
11
|
-
|
12
|
-
before :all do
|
13
|
-
connection.raw_connection.drop_table?(:people)
|
14
|
-
connection.raw_connection.create_table(:people) do
|
15
|
-
primary_key :id
|
16
|
-
String :_id
|
17
|
-
String :_type
|
18
|
-
String :name
|
19
|
-
String :email
|
20
|
-
Time :created_at
|
21
|
-
Time :updated_at
|
22
|
-
end
|
23
|
-
|
24
|
-
connection.save(Pupa::Person.new(_id: 'existing', name: 'existing', email: 'existing@example.com'))
|
25
|
-
connection.raw_connection[:people].insert(_type: 'pupa/person', name: 'non-unique')
|
26
|
-
connection.raw_connection[:people].insert(_type: 'pupa/person', name: 'non-unique')
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '.find' do
|
30
|
-
it 'should raise an error if selector is empty' do
|
31
|
-
expect{connection.find(_type: _type)}.to raise_error(Pupa::Errors::EmptySelectorError)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should return nil if no matches' do
|
35
|
-
connection.find(_type: _type, name: 'nonexistent').should == nil
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should return a document if one match' do
|
39
|
-
connection.find(_type: _type, name: 'existing').should be_a(Hash)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should raise an error if many matches' do
|
43
|
-
expect{connection.find(_type: 'pupa/person', name: 'non-unique')}.to raise_error(Pupa::Errors::TooManyMatches)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '.save' do
|
48
|
-
it 'should raise an error if selector is empty' do
|
49
|
-
expect{connection.save(Pupa::Person.new)}.to raise_error(Pupa::Errors::EmptySelectorError)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should insert a document if no matches' do
|
53
|
-
connection.save(Pupa::Person.new(_id: 'new', name: 'new', email: 'new@example.com')).should == [true, 'new']
|
54
|
-
connection.find(_type: _type, name: 'new')['email'].should == 'new@example.com'
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'should update a document if one match' do
|
58
|
-
connection.save(Pupa::Person.new(_id: 'changed', name: 'existing', email: 'changed@example.com')).should == [false, 'existing']
|
59
|
-
connection.find(_type: _type, name: 'existing')['email'].should == 'changed@example.com'
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should raise an error if many matches' do
|
63
|
-
expect{connection.save(Pupa::Person.new(name: 'non-unique'))}.to raise_error(Pupa::Errors::TooManyMatches)
|
64
|
-
end
|
65
|
-
end
|
4
|
+
include_examples 'SQL adapter', 'postgres://localhost:5432/pupa_test'
|
66
5
|
end
|
@@ -3,12 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe Pupa::Processor::Connection do
|
4
4
|
describe '.new' do
|
5
5
|
it 'should use MongoDB' do
|
6
|
-
Pupa::Processor::Connection::MongoDBAdapter.
|
6
|
+
expect(Pupa::Processor::Connection::MongoDBAdapter).to receive(:new).with('mongodb://localhost:27017/pupa').and_call_original
|
7
7
|
Pupa::Processor::Connection.new('mongodb://localhost:27017/pupa')
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should use PostgreSQL' do
|
11
|
-
Pupa::Processor::Connection::PostgreSQLAdapter.
|
11
|
+
expect(Pupa::Processor::Connection::PostgreSQLAdapter).to receive(:new).with('postgres://localhost:5432/pupa').and_call_original
|
12
12
|
Pupa::Processor::Connection.new('postgres://localhost:5432/pupa')
|
13
13
|
end
|
14
14
|
end
|
@@ -7,52 +7,52 @@ describe Pupa::Processor::DocumentStore::FileStore do
|
|
7
7
|
|
8
8
|
describe '#exist?' do
|
9
9
|
it 'should return true if the store contains an entry for the given key' do
|
10
|
-
store.exist?('foo.json').
|
10
|
+
expect(store.exist?('foo.json')).to eq(true)
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should return false if the store does not contain an entry for the given key' do
|
14
|
-
store.exist?('nonexistent').
|
14
|
+
expect(store.exist?('nonexistent')).to eq(false)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#entries' do
|
19
19
|
it 'should return all keys in the store' do
|
20
|
-
store.entries.sort.
|
20
|
+
expect(store.entries.sort).to eq(%w(bar.json baz.json foo.json))
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '#read' do
|
25
25
|
it 'should return the value of the given key' do
|
26
|
-
store.read('foo.json').
|
26
|
+
expect(store.read('foo.json')).to eq({'name' => 'foo'})
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '#read_multi' do
|
31
31
|
it 'should return the values of the given keys' do
|
32
|
-
store.read_multi(%w(foo.json bar.json)).
|
32
|
+
expect(store.read_multi(%w(foo.json bar.json))).to eq([{'name' => 'foo'}, {'name' => 'bar'}])
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe '#write' do
|
37
37
|
it 'should write an entry with the given value for the given key' do
|
38
|
-
store.exist?('new.json').
|
38
|
+
expect(store.exist?('new.json')).to eq(false)
|
39
39
|
store.write('new.json', {name: 'new'})
|
40
|
-
store.read('new.json').
|
40
|
+
expect(store.read('new.json')).to eq({'name' => 'new'})
|
41
41
|
store.delete('new.json') # cleanup
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe '#write_unless_exists' do
|
46
46
|
it 'should write an entry with the given value for the given key' do
|
47
|
-
store.exist?('new.json').
|
48
|
-
store.write_unless_exists('new.json', {name: 'new'}).
|
49
|
-
store.read('new.json').
|
47
|
+
expect(store.exist?('new.json')).to eq(false)
|
48
|
+
expect(store.write_unless_exists('new.json', {name: 'new'})).to eq(true)
|
49
|
+
expect(store.read('new.json')).to eq({'name' => 'new'})
|
50
50
|
store.delete('new.json') # cleanup
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should not write an entry with the given value for the given key if the key exists' do
|
54
|
-
store.write_unless_exists('foo.json', {name: 'new'}).
|
55
|
-
store.read('foo.json').
|
54
|
+
expect(store.write_unless_exists('foo.json', {name: 'new'})).to eq(false)
|
55
|
+
expect(store.read('foo.json')).to eq({'name' => 'foo'})
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -64,10 +64,10 @@ describe Pupa::Processor::DocumentStore::FileStore do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
pairs.keys.each do |name|
|
67
|
-
store.exist?(name).
|
67
|
+
expect(store.exist?(name)).to eq(false)
|
68
68
|
end
|
69
69
|
store.write_multi(pairs)
|
70
|
-
store.read_multi(pairs.keys).
|
70
|
+
expect(store.read_multi(pairs.keys)).to eq([{'name' => 'new1'}, {'name' => 'new2'}])
|
71
71
|
pairs.keys.each do |name| # cleanup
|
72
72
|
store.delete(name)
|
73
73
|
end
|
@@ -77,17 +77,17 @@ describe Pupa::Processor::DocumentStore::FileStore do
|
|
77
77
|
describe '#delete' do
|
78
78
|
it 'should delete an entry with the given key from the store' do
|
79
79
|
store.write('new.json', {name: 'new'})
|
80
|
-
store.exist?('new.json').
|
80
|
+
expect(store.exist?('new.json')).to eq(true)
|
81
81
|
store.delete('new.json')
|
82
|
-
store.exist?('new.json').
|
82
|
+
expect(store.exist?('new.json')).to eq(false)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
describe '#clear' do
|
87
87
|
it 'should delete all entries from the store' do
|
88
|
-
store.entries.sort.
|
88
|
+
expect(store.entries.sort).to eq(%w(bar.json baz.json foo.json))
|
89
89
|
store.clear
|
90
|
-
store.entries.
|
90
|
+
expect(store.entries).to eq([])
|
91
91
|
|
92
92
|
%w(bar baz foo).each do |name| # cleanup
|
93
93
|
store.write("#{name}.json", {name: name})
|
@@ -97,7 +97,7 @@ describe Pupa::Processor::DocumentStore::FileStore do
|
|
97
97
|
|
98
98
|
describe '#path' do
|
99
99
|
it 'should return the file path to the entry' do
|
100
|
-
store.path('foo').
|
100
|
+
expect(store.path('foo')).to eq(File.expand_path(File.join('..', '..', 'fixtures', 'foo'), __dir__))
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
@@ -14,52 +14,52 @@ describe Pupa::Processor::DocumentStore::RedisStore do
|
|
14
14
|
|
15
15
|
describe '#exist?' do
|
16
16
|
it 'should return true if the store contains an entry for the given key' do
|
17
|
-
store.exist?('foo.json').
|
17
|
+
expect(store.exist?('foo.json')).to eq(true)
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should return false if the store does not contain an entry for the given key' do
|
21
|
-
store.exist?('nonexistent').
|
21
|
+
expect(store.exist?('nonexistent')).to eq(false)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#entries' do
|
26
26
|
it 'should return all keys in the store' do
|
27
|
-
store.entries.sort.
|
27
|
+
expect(store.entries.sort).to eq(%w(bar.json baz.json foo.json))
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#read' do
|
32
32
|
it 'should return the value of the given key' do
|
33
|
-
store.read('foo.json').
|
33
|
+
expect(store.read('foo.json')).to eq({'name' => 'foo'})
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe '#read_multi' do
|
38
38
|
it 'should return the values of the given keys' do
|
39
|
-
store.read_multi(%w(foo.json bar.json)).
|
39
|
+
expect(store.read_multi(%w(foo.json bar.json))).to eq([{'name' => 'foo'}, {'name' => 'bar'}])
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe '#write' do
|
44
44
|
it 'should write an entry with the given value for the given key' do
|
45
|
-
store.exist?('new.json').
|
45
|
+
expect(store.exist?('new.json')).to eq(false)
|
46
46
|
store.write('new.json', {name: 'new'})
|
47
|
-
store.read('new.json').
|
47
|
+
expect(store.read('new.json')).to eq({'name' => 'new'})
|
48
48
|
store.delete('new.json') # cleanup
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
describe '#write_unless_exists' do
|
53
53
|
it 'should write an entry with the given value for the given key' do
|
54
|
-
store.exist?('new.json').
|
55
|
-
store.write_unless_exists('new.json', {name: 'new'}).
|
56
|
-
store.read('new.json').
|
54
|
+
expect(store.exist?('new.json')).to eq(false)
|
55
|
+
expect(store.write_unless_exists('new.json', {name: 'new'})).to eq(true)
|
56
|
+
expect(store.read('new.json')).to eq({'name' => 'new'})
|
57
57
|
store.delete('new.json') # cleanup
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'should not write an entry with the given value for the given key if the key exists' do
|
61
|
-
store.write_unless_exists('foo.json', {name: 'new'}).
|
62
|
-
store.read('foo.json').
|
61
|
+
expect(store.write_unless_exists('foo.json', {name: 'new'})).to eq(false)
|
62
|
+
expect(store.read('foo.json')).to eq({'name' => 'foo'})
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -71,10 +71,10 @@ describe Pupa::Processor::DocumentStore::RedisStore do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
pairs.keys.each do |name|
|
74
|
-
store.exist?(name).
|
74
|
+
expect(store.exist?(name)).to eq(false)
|
75
75
|
end
|
76
76
|
store.write_multi(pairs)
|
77
|
-
store.read_multi(pairs.keys).
|
77
|
+
expect(store.read_multi(pairs.keys)).to eq([{'name' => 'new1'}, {'name' => 'new2'}])
|
78
78
|
pairs.keys.each do |name| # cleanup
|
79
79
|
store.delete(name)
|
80
80
|
end
|
@@ -84,17 +84,17 @@ describe Pupa::Processor::DocumentStore::RedisStore do
|
|
84
84
|
describe '#delete' do
|
85
85
|
it 'should delete an entry with the given key from the store' do
|
86
86
|
store.write('new.json', {name: 'new'})
|
87
|
-
store.exist?('new.json').
|
87
|
+
expect(store.exist?('new.json')).to eq(true)
|
88
88
|
store.delete('new.json')
|
89
|
-
store.exist?('new.json').
|
89
|
+
expect(store.exist?('new.json')).to eq(false)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
describe '#clear' do
|
94
94
|
it 'should delete all entries from the store' do
|
95
|
-
store.entries.sort.
|
95
|
+
expect(store.entries.sort).to eq(%w(bar.json baz.json foo.json))
|
96
96
|
store.clear
|
97
|
-
store.entries.
|
97
|
+
expect(store.entries).to eq([])
|
98
98
|
|
99
99
|
%w(bar baz foo).each do |name| # cleanup
|
100
100
|
store.write("#{name}.json", {name: name})
|
@@ -3,12 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe Pupa::Processor::DocumentStore do
|
4
4
|
describe '.new' do
|
5
5
|
it 'should use the filesystem' do
|
6
|
-
Pupa::Processor::DocumentStore::FileStore.
|
6
|
+
expect(Pupa::Processor::DocumentStore::FileStore).to receive(:new).with('/tmp').and_call_original
|
7
7
|
Pupa::Processor::DocumentStore.new('/tmp')
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should use Redis' do
|
11
|
-
Pupa::Processor::DocumentStore::RedisStore.
|
11
|
+
expect(Pupa::Processor::DocumentStore::RedisStore).to receive(:new).with('redis://localhost', {}).and_call_original
|
12
12
|
Pupa::Processor::DocumentStore.new('redis://localhost')
|
13
13
|
end
|
14
14
|
end
|
@@ -27,15 +27,15 @@ describe Pupa::Processor::Middleware::Logger do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should still return output' do
|
30
|
-
@response.body.
|
30
|
+
expect(@response.body).to eq('hello')
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should log the method and URL' do
|
34
|
-
io.string.
|
34
|
+
expect(io.string).to match('get http:/hello')
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should log request headers' do
|
38
|
-
io.string.
|
38
|
+
expect(io.string).to match('Accept: "text/html')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -62,11 +62,11 @@ describe Pupa::Processor::Middleware::Logger do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'should log the method and URL' do
|
65
|
-
io.string.
|
65
|
+
expect(io.string).to match('get http:/hello')
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'should not log request headers' do
|
69
|
-
io.string.
|
69
|
+
expect(io.string).not_to match('Accept: "text/html')
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -76,11 +76,11 @@ describe Pupa::Processor::Middleware::Logger do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'should log the method and URL' do
|
79
|
-
io.string.
|
79
|
+
expect(io.string).to match('post http:/hello foo=bar')
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'should not log request headers' do
|
83
|
-
io.string.
|
83
|
+
expect(io.string).not_to match('Accept: "text/html')
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -21,11 +21,11 @@ describe Pupa::Processor::Yielder do
|
|
21
21
|
yielder.each do |n|
|
22
22
|
array << n
|
23
23
|
end
|
24
|
-
array.
|
24
|
+
expect(array).to eq((0..9).to_a)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should be composable with other iterators' do
|
28
|
-
yielder.each.map{|n| n}.
|
28
|
+
expect(yielder.each.map{|n| n}).to eq((0..9).to_a)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -35,7 +35,7 @@ describe Pupa::Processor::Yielder do
|
|
35
35
|
10.times do |n|
|
36
36
|
array << yielder.next
|
37
37
|
end
|
38
|
-
array.
|
38
|
+
expect(array).to eq((0..9).to_a)
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should raise an error if the enumerator is at the end' do
|
@@ -45,7 +45,7 @@ describe Pupa::Processor::Yielder do
|
|
45
45
|
|
46
46
|
describe '#to_enum' do
|
47
47
|
it 'should return an enumerator' do
|
48
|
-
yielder.to_enum.
|
48
|
+
expect(yielder.to_enum).to be_a(Enumerator)
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should return a lazy enumerator' do
|