hyper_iterator-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ email: MyString
5
+
6
+ two:
7
+ email: MyString
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -1,7 +1,47 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class HyperIteratorRailsTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, HyperIteratorRails
4
+ setup do
5
+ User.create(email: 'foobar1@example.com')
6
+ User.create(email: 'foobar2@example.com')
7
+ User.create(email: 'foobar3@example.com')
8
+ User.create(email: 'foobar4@example.com')
9
+ User.create(email: 'foobar5@example.com')
10
+ User.create(email: 'foobar6@example.com')
11
+ User.create(email: 'foobar7@example.com')
12
+ User.create(email: 'foobar8@example.com')
13
+ end
14
+
15
+ teardown do
16
+ User.destroy_all
17
+ end
18
+
19
+ test 'ActiveRecord::Result responds to each! method' do
20
+ assert ActiveRecord::Result.instance_methods.include?(:each!)
21
+ end
22
+
23
+ test 'each! iterates through the result like each' do
24
+ users = ActiveRecord::Base.connection.select_all('select * from users')
25
+ users_each = []
26
+ users_each_bang = []
27
+ users.each { |user| users_each << user }
28
+ users.each! { |user| users_each_bang << user }
29
+
30
+ assert users_each == users_each_bang
31
+ end
32
+
33
+ test 'ActiveRecord collection responds to each! method' do
34
+ users = User.where(email: 'foobar1@example.com')
35
+ assert users.respond_to?(:each!)
36
+ end
37
+
38
+ test 'each! iterates through the collection like each' do
39
+ users = User.all
40
+ users_each = []
41
+ users_each_bang = []
42
+ users.each { |user| users_each << user }
43
+ users.each! { |user| users_each_bang << user }
44
+
45
+ assert users_each == users_each_bang
6
46
  end
7
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyper_iterator-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Li
@@ -16,19 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.2
19
+ version: '0.3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.3.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: 0.2.2
29
+ version: '0.3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.3.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rails
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
40
+ - - ">="
32
41
  - !ruby/object:Gem::Version
33
42
  version: 4.0.5
34
43
  type: :runtime
@@ -36,6 +45,9 @@ dependencies:
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '4.0'
50
+ - - ">="
39
51
  - !ruby/object:Gem::Version
40
52
  version: 4.0.5
41
53
  - !ruby/object:Gem::Dependency
@@ -70,6 +82,7 @@ files:
70
82
  - test/dummy/app/assets/stylesheets/application.css
71
83
  - test/dummy/app/controllers/application_controller.rb
72
84
  - test/dummy/app/helpers/application_helper.rb
85
+ - test/dummy/app/models/user.rb
73
86
  - test/dummy/app/views/layouts/application.html.erb
74
87
  - test/dummy/bin/bundle
75
88
  - test/dummy/bin/rails
@@ -91,12 +104,18 @@ files:
91
104
  - test/dummy/config/initializers/wrap_parameters.rb
92
105
  - test/dummy/config/locales/en.yml
93
106
  - test/dummy/config/routes.rb
107
+ - test/dummy/db/development.sqlite3
108
+ - test/dummy/db/migrate/20170318182325_create_users.rb
109
+ - test/dummy/db/schema.rb
94
110
  - test/dummy/db/test.sqlite3
111
+ - test/dummy/log/development.log
95
112
  - test/dummy/log/test.log
96
113
  - test/dummy/public/404.html
97
114
  - test/dummy/public/422.html
98
115
  - test/dummy/public/500.html
99
116
  - test/dummy/public/favicon.ico
117
+ - test/dummy/test/fixtures/users.yml
118
+ - test/dummy/test/models/user_test.rb
100
119
  - test/hyper_iterator_rails_test.rb
101
120
  - test/test_helper.rb
102
121
  homepage: https://github.com/EdmundLeex/hyper_iterator-rails
@@ -127,6 +146,7 @@ test_files:
127
146
  - test/dummy/app/assets/stylesheets/application.css
128
147
  - test/dummy/app/controllers/application_controller.rb
129
148
  - test/dummy/app/helpers/application_helper.rb
149
+ - test/dummy/app/models/user.rb
130
150
  - test/dummy/app/views/layouts/application.html.erb
131
151
  - test/dummy/bin/bundle
132
152
  - test/dummy/bin/rails
@@ -148,7 +168,11 @@ test_files:
148
168
  - test/dummy/config/locales/en.yml
149
169
  - test/dummy/config/routes.rb
150
170
  - test/dummy/config.ru
171
+ - test/dummy/db/development.sqlite3
172
+ - test/dummy/db/migrate/20170318182325_create_users.rb
173
+ - test/dummy/db/schema.rb
151
174
  - test/dummy/db/test.sqlite3
175
+ - test/dummy/log/development.log
152
176
  - test/dummy/log/test.log
153
177
  - test/dummy/public/404.html
154
178
  - test/dummy/public/422.html
@@ -156,5 +180,7 @@ test_files:
156
180
  - test/dummy/public/favicon.ico
157
181
  - test/dummy/Rakefile
158
182
  - test/dummy/README.rdoc
183
+ - test/dummy/test/fixtures/users.yml
184
+ - test/dummy/test/models/user_test.rb
159
185
  - test/hyper_iterator_rails_test.rb
160
186
  - test/test_helper.rb