dump 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +8 -8
  2. data/.rubocop.yml +53 -0
  3. data/.rubocop_todo.yml +33 -0
  4. data/.travis.yml +12 -3
  5. data/README.markdown +8 -0
  6. data/dump.gemspec +4 -1
  7. data/lib/dump.rb +1 -0
  8. data/lib/dump/capistrano.rb +7 -1
  9. data/lib/dump/capistrano/v2.rb +331 -0
  10. data/lib/dump/railtie.rb +1 -0
  11. data/lib/dump_rake.rb +17 -8
  12. data/lib/dump_rake/archive_tar_minitar_fix.rb +3 -1
  13. data/lib/dump_rake/assets.rb +1 -0
  14. data/lib/dump_rake/continious_timeout.rb +17 -17
  15. data/lib/dump_rake/dump.rb +27 -22
  16. data/lib/dump_rake/dump_reader.rb +62 -63
  17. data/lib/dump_rake/dump_writer.rb +20 -21
  18. data/lib/dump_rake/env.rb +12 -10
  19. data/lib/dump_rake/env/filter.rb +3 -0
  20. data/lib/dump_rake/rails_root.rb +1 -0
  21. data/lib/dump_rake/table_manipulation.rb +23 -20
  22. data/lib/generators/assets_config/assets_config_generator.rb +2 -0
  23. data/lib/tasks/assets.rake +1 -2
  24. data/lib/tasks/dump.rake +5 -6
  25. data/recipes/dump.rb +1 -343
  26. data/script/update_readme +5 -3
  27. data/spec/cycle_spec.rb +33 -30
  28. data/spec/dummy_rails_app.rb +42 -0
  29. data/spec/lib/dump_rake/dump_reader_spec.rb +80 -92
  30. data/spec/lib/dump_rake/dump_spec.rb +56 -58
  31. data/spec/lib/dump_rake/dump_writer_spec.rb +42 -43
  32. data/spec/lib/dump_rake/env/filter_spec.rb +9 -9
  33. data/spec/lib/dump_rake/env_spec.rb +21 -21
  34. data/spec/lib/dump_rake/rails_root_spec.rb +7 -7
  35. data/spec/lib/dump_rake/table_manipulation_spec.rb +57 -63
  36. data/spec/lib/dump_rake_spec.rb +76 -76
  37. data/spec/recipes/dump_spec.rb +241 -217
  38. data/spec/spec_helper.rb +1 -42
  39. data/spec/tasks/assets_spec.rb +18 -18
  40. data/spec/tasks/dump_spec.rb +18 -18
  41. metadata +21 -2
@@ -1,8 +1,8 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  Filter = DumpRake::Env::Filter
4
4
  describe Filter do
5
- it "should pass everything if initialized with nil" do
5
+ it 'should pass everything if initialized with nil' do
6
6
  filter = Filter.new(nil)
7
7
  expect(filter.pass?('a')).to be_truthy
8
8
  expect(filter.pass?('b')).to be_truthy
@@ -10,7 +10,7 @@ describe Filter do
10
10
  expect(filter.pass?('d')).to be_truthy
11
11
  end
12
12
 
13
- it "should pass only specified values" do
13
+ it 'should pass only specified values' do
14
14
  filter = Filter.new('a,c')
15
15
  expect(filter.pass?('a')).to be_truthy
16
16
  expect(filter.pass?('b')).to be_falsey
@@ -18,7 +18,7 @@ describe Filter do
18
18
  expect(filter.pass?('d')).to be_falsey
19
19
  end
20
20
 
21
- it "should not pass anything if initialized empty" do
21
+ it 'should not pass anything if initialized empty' do
22
22
  filter = Filter.new('')
23
23
  expect(filter.pass?('a')).to be_falsey
24
24
  expect(filter.pass?('b')).to be_falsey
@@ -26,8 +26,8 @@ describe Filter do
26
26
  expect(filter.pass?('d')).to be_falsey
27
27
  end
28
28
 
29
- describe "when initialized with -" do
30
- it "should pass everything except specified values" do
29
+ describe 'when initialized with -' do
30
+ it 'should pass everything except specified values' do
31
31
  filter = Filter.new('-a,c')
32
32
  expect(filter.pass?('a')).to be_falsey
33
33
  expect(filter.pass?('b')).to be_truthy
@@ -35,7 +35,7 @@ describe Filter do
35
35
  expect(filter.pass?('d')).to be_truthy
36
36
  end
37
37
 
38
- it "should pass everything if initialized empty" do
38
+ it 'should pass everything if initialized empty' do
39
39
  filter = Filter.new('-')
40
40
  expect(filter.pass?('a')).to be_truthy
41
41
  expect(filter.pass?('b')).to be_truthy
@@ -44,8 +44,8 @@ describe Filter do
44
44
  end
45
45
  end
46
46
 
47
- describe "custom_pass?" do
48
- it "should pass only when any call to block returns true" do
47
+ describe 'custom_pass?' do
48
+ it 'should pass only when any call to block returns true' do
49
49
  filter = Filter.new('a,c')
50
50
  expect(filter.custom_pass?{ |value| value == 'a' }).to be_truthy
51
51
  expect(filter.custom_pass?{ |value| value == 'b' }).to be_falsey
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  Env = DumpRake::Env
4
4
  describe Env do
@@ -21,8 +21,8 @@ describe Env do
21
21
  end
22
22
  end
23
23
 
24
- describe "with_env" do
25
- it "should set env to new_value for duration of block" do
24
+ describe 'with_env' do
25
+ it 'should set env to new_value for duration of block' do
26
26
  ENV['LIKE'] = 'old_value'
27
27
 
28
28
  expect(ENV['LIKE']).to eq('old_value')
@@ -32,7 +32,7 @@ describe Env do
32
32
  expect(ENV['LIKE']).to eq('old_value')
33
33
  end
34
34
 
35
- it "should use dictionary" do
35
+ it 'should use dictionary' do
36
36
  ENV['LIKE'] = 'old_value'
37
37
 
38
38
  expect(ENV['LIKE']).to eq('old_value')
@@ -43,17 +43,17 @@ describe Env do
43
43
  end
44
44
  end
45
45
 
46
- describe "[]" do
47
- it "should mimic ENV" do
46
+ describe '[]' do
47
+ it 'should mimic ENV' do
48
48
  ENV['VERSION'] = 'VERSION_value'
49
49
  expect(Env['VERSION']).to eq(ENV['VERSION'])
50
50
  end
51
51
 
52
- it "should return nil on non existing env variable" do
52
+ it 'should return nil on non existing env variable' do
53
53
  expect(Env['DESCRIPTON']).to eq(nil)
54
54
  end
55
55
 
56
- it "should get first value that is set" do
56
+ it 'should get first value that is set' do
57
57
  ENV['VERSION'] = 'VERSION_value'
58
58
  expect(Env[:like]).to eq('VERSION_value')
59
59
  ENV['VER'] = 'VER_value'
@@ -62,17 +62,17 @@ describe Env do
62
62
  expect(Env[:like]).to eq('LIKE_value')
63
63
  end
64
64
 
65
- it "should return nil for unset variable" do
65
+ it 'should return nil for unset variable' do
66
66
  expect(Env[:desc]).to eq(nil)
67
67
  end
68
68
  end
69
69
 
70
- describe "filter" do
70
+ describe 'filter' do
71
71
  before do
72
72
  Env.instance_variable_set(:@filters, nil)
73
73
  end
74
74
 
75
- it "should return Filter" do
75
+ it 'should return Filter' do
76
76
  ENV['TABLES'] = 'a,b,c'
77
77
  filter = Env.filter('TABLES')
78
78
  expect(filter).to be_instance_of(Env::Filter)
@@ -80,7 +80,7 @@ describe Env do
80
80
  expect(filter.values).to eq(%w[a b c])
81
81
  end
82
82
 
83
- it "should cache created filter" do
83
+ it 'should cache created filter' do
84
84
  ENV['TABLES'] = 'a,b,c'
85
85
  ENV['TABLES2'] = 'a,b,c'
86
86
  expect(Env::Filter).to receive(:new).with('a,b,c', nil).once
@@ -90,16 +90,16 @@ describe Env do
90
90
  end
91
91
  end
92
92
 
93
- describe "for_command" do
94
- describe "when no vars present" do
95
- it "should return empty hash for every command" do
93
+ describe 'for_command' do
94
+ describe 'when no vars present' do
95
+ it 'should return empty hash for every command' do
96
96
  expect(Env.for_command(:create)).to eq({})
97
97
  expect(Env.for_command(:restore)).to eq({})
98
98
  expect(Env.for_command(:versions)).to eq({})
99
99
  expect(Env.for_command(:bad)).to eq({})
100
100
  end
101
101
 
102
- it "should return empty hash for every command when asking for string keys" do
102
+ it 'should return empty hash for every command when asking for string keys' do
103
103
  expect(Env.for_command(:create, true)).to eq({})
104
104
  expect(Env.for_command(:restore, true)).to eq({})
105
105
  expect(Env.for_command(:versions, true)).to eq({})
@@ -107,20 +107,20 @@ describe Env do
107
107
  end
108
108
  end
109
109
 
110
- describe "when vars are present" do
110
+ describe 'when vars are present' do
111
111
  before do
112
112
  ENV['LIKE'] = 'Version'
113
113
  ENV['DESC'] = 'Description'
114
114
  end
115
115
 
116
- it "should return hash with symbol keys for every command" do
116
+ it 'should return hash with symbol keys for every command' do
117
117
  expect(Env.for_command(:create)).to eq({:desc => 'Description'})
118
118
  expect(Env.for_command(:restore)).to eq({:like => 'Version'})
119
119
  expect(Env.for_command(:versions)).to eq({:like => 'Version'})
120
120
  expect(Env.for_command(:bad)).to eq({})
121
121
  end
122
122
 
123
- it "should return hash with symbol keys for every command when asking for string keys" do
123
+ it 'should return hash with symbol keys for every command when asking for string keys' do
124
124
  expect(Env.for_command(:create, true)).to eq({'DESC' => 'Description'})
125
125
  expect(Env.for_command(:restore, true)).to eq({'LIKE' => 'Version'})
126
126
  expect(Env.for_command(:versions, true)).to eq({'LIKE' => 'Version'})
@@ -129,8 +129,8 @@ describe Env do
129
129
  end
130
130
  end
131
131
 
132
- describe "stringify!" do
133
- it "should convert keys to strings" do
132
+ describe 'stringify!' do
133
+ it 'should convert keys to strings' do
134
134
  @env = {:desc => 'text', :tags => 'a b c', 'LEAVE' => 'none', 'OTHER' => 'data'}
135
135
  Env.stringify!(@env)
136
136
  expect(@env).to eq({'DESC' => 'text', 'TAGS' => 'a b c', 'LEAVE' => 'none', 'OTHER' => 'data'})
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  def temp_remove_const(where, which)
4
4
  around do |example|
@@ -24,22 +24,22 @@ describe 'RailsRoot' do
24
24
  temp_remove_const Object, :RAILS_ROOT
25
25
  temp_remove_const DumpRake, :RailsRoot
26
26
 
27
- it "should use Rails if it is present" do
27
+ it 'should use Rails if it is present' do
28
28
  Object.const_set('Rails', double('rails'))
29
29
  expect(Rails).to receive(:root).and_return(@root)
30
30
  load 'dump_rake/rails_root.rb'
31
- expect(DumpRake::RailsRoot).to be === @root
31
+ expect(DumpRake::RailsRoot).to equal(@root)
32
32
  end
33
33
 
34
- it "should use RAILS_ROOT if it is present" do
34
+ it 'should use RAILS_ROOT if it is present' do
35
35
  Object.const_set('RAILS_ROOT', @root)
36
36
  load 'dump_rake/rails_root.rb'
37
- expect(DumpRake::RailsRoot).to be === @root
37
+ expect(DumpRake::RailsRoot).to equal(@root)
38
38
  end
39
39
 
40
- it "should use Dir.pwd else" do
40
+ it 'should use Dir.pwd else' do
41
41
  expect(Dir).to receive(:pwd).and_return(@root)
42
42
  load 'dump_rake/rails_root.rb'
43
- expect(DumpRake::RailsRoot).to be === @root
43
+ expect(DumpRake::RailsRoot).to equal(@root)
44
44
  end
45
45
  end
@@ -1,73 +1,71 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- require File.dirname(__FILE__) + '/../../../lib/dump_rake'
1
+ require 'spec_helper'
2
+ require 'dump_rake'
4
3
 
5
4
  TableManipulation = DumpRake::TableManipulation
6
5
  describe TableManipulation do
7
6
  include TableManipulation
8
7
 
9
- describe "schema_tables" do
10
- it "should return schema_tables" do
8
+ describe 'schema_tables' do
9
+ it 'should return schema_tables' do
11
10
  expect(schema_tables).to eq(%w[schema_info schema_migrations])
12
11
  end
13
12
  end
14
13
 
15
- describe "verify_connection" do
16
- it "should return result of ActiveRecord::Base.connection.verify!" do
14
+ describe 'verify_connection' do
15
+ it 'should return result of ActiveRecord::Base.connection.verify!' do
17
16
  expect(ActiveRecord::Base.connection).to receive(:verify!).and_return(:result)
18
17
  expect(verify_connection).to eq(:result)
19
18
  end
20
19
  end
21
20
 
22
- describe "quote_table_name" do
23
- it "should return result of ActiveRecord::Base.connection.quote_table_name" do
21
+ describe 'quote_table_name' do
22
+ it 'should return result of ActiveRecord::Base.connection.quote_table_name' do
24
23
  expect(ActiveRecord::Base.connection).to receive(:quote_table_name).with('first').and_return('`first`')
25
24
  expect(quote_table_name('first')).to eq('`first`')
26
25
  end
27
26
  end
28
27
 
29
- describe "quote_column_name" do
30
- it "should return result of ActiveRecord::Base.connection.quote_column_name" do
28
+ describe 'quote_column_name' do
29
+ it 'should return result of ActiveRecord::Base.connection.quote_column_name' do
31
30
  expect(ActiveRecord::Base.connection).to receive(:quote_column_name).with('first').and_return('`first`')
32
31
  expect(quote_column_name('first')).to eq('`first`')
33
32
  end
34
33
  end
35
34
 
36
- describe "quote_value" do
37
- it "should return result of ActiveRecord::Base.connection.quote_value" do
35
+ describe 'quote_value' do
36
+ it 'should return result of ActiveRecord::Base.connection.quote_value' do
38
37
  expect(ActiveRecord::Base.connection).to receive(:quote).with('first').and_return('`first`')
39
38
  expect(quote_value('first')).to eq('`first`')
40
39
  end
41
40
  end
42
41
 
43
-
44
- describe "clear_table" do
45
- it "should call ActiveRecord::Base.connection.delete with sql for deleting everything from table" do
42
+ describe 'clear_table' do
43
+ it 'should call ActiveRecord::Base.connection.delete with sql for deleting everything from table' do
46
44
  expect(ActiveRecord::Base.connection).to receive(:delete).with('DELETE FROM `first`', anything)
47
45
  clear_table('`first`')
48
46
  end
49
47
  end
50
48
 
51
- describe "insert_into_table" do
52
- it "should call ActiveRecord::Base.connection.insert with sql for insert if values is string" do
53
- expect(ActiveRecord::Base.connection).to receive(:insert).with("INSERT INTO `table` (`c1`,`c2`) VALUES (`v1`,`v2`)", anything)
49
+ describe 'insert_into_table' do
50
+ it 'should call ActiveRecord::Base.connection.insert with sql for insert if values is string' do
51
+ expect(ActiveRecord::Base.connection).to receive(:insert).with('INSERT INTO `table` (`c1`,`c2`) VALUES (`v1`,`v2`)', anything)
54
52
  insert_into_table('`table`', '(`c1`,`c2`)', '(`v1`,`v2`)')
55
53
  end
56
54
 
57
- it "should call ActiveRecord::Base.connection.insert with sql for insert if values is array" do
58
- expect(ActiveRecord::Base.connection).to receive(:insert).with("INSERT INTO `table` (`c1`,`c2`) VALUES (`v11`,`v12`),(`v21`,`v22`)", anything)
55
+ it 'should call ActiveRecord::Base.connection.insert with sql for insert if values is array' do
56
+ expect(ActiveRecord::Base.connection).to receive(:insert).with('INSERT INTO `table` (`c1`,`c2`) VALUES (`v11`,`v12`),(`v21`,`v22`)', anything)
59
57
  insert_into_table('`table`', '(`c1`,`c2`)', ['(`v11`,`v12`)', '(`v21`,`v22`)'])
60
58
  end
61
59
  end
62
60
 
63
- describe "join_for_sql" do
61
+ describe 'join_for_sql' do
64
62
  it "should convert array ['`a`', '`b`'] to \"(`a`,`b`)\"" do
65
63
  expect(join_for_sql(%w[`a` `b`])).to eq('(`a`,`b`)')
66
64
  end
67
65
  end
68
66
 
69
- describe "columns_insert_sql" do
70
- it "should return columns sql part for insert" do
67
+ describe 'columns_insert_sql' do
68
+ it 'should return columns sql part for insert' do
71
69
  expect(self).to receive(:quote_column_name).with('a').and_return('`a`')
72
70
  expect(self).to receive(:quote_column_name).with('b').and_return('`b`')
73
71
 
@@ -75,8 +73,8 @@ describe TableManipulation do
75
73
  end
76
74
  end
77
75
 
78
- describe "values_insert_sql" do
79
- it "should return values sql part for insert" do
76
+ describe 'values_insert_sql' do
77
+ it 'should return values sql part for insert' do
80
78
  expect(self).to receive(:quote_value).with('a').and_return('`a`')
81
79
  expect(self).to receive(:quote_value).with('b').and_return('`b`')
82
80
 
@@ -84,48 +82,47 @@ describe TableManipulation do
84
82
  end
85
83
  end
86
84
 
87
-
88
- describe "tables_to_dump" do
89
- it "should call ActiveRecord::Base.connection.tables" do
85
+ describe 'tables_to_dump' do
86
+ it 'should call ActiveRecord::Base.connection.tables' do
90
87
  expect(ActiveRecord::Base.connection).to receive(:tables).and_return([])
91
88
  tables_to_dump
92
89
  end
93
90
 
94
- it "should exclude sessions table from result" do
91
+ it 'should exclude sessions table from result' do
95
92
  expect(ActiveRecord::Base.connection).to receive(:tables).and_return(%w[first second schema_info schema_migrations sessions])
96
93
  expect(tables_to_dump).to eq(%w[first second schema_info schema_migrations])
97
94
  end
98
95
 
99
- describe "with user defined tables" do
96
+ describe 'with user defined tables' do
100
97
  before do
101
98
  expect(ActiveRecord::Base.connection).to receive(:tables).and_return(%w[first second schema_info schema_migrations sessions])
102
99
  end
103
100
 
104
- it "should select certain tables" do
101
+ it 'should select certain tables' do
105
102
  DumpRake::Env.with_env(:tables => 'first,third,-fifth') do
106
103
  expect(tables_to_dump).to eq(%w[first schema_info schema_migrations])
107
104
  end
108
105
  end
109
106
 
110
- it "should select skip certain tables" do
107
+ it 'should select skip certain tables' do
111
108
  DumpRake::Env.with_env(:tables => '-first,third,-fifth') do
112
109
  expect(tables_to_dump).to eq(%w[second schema_info schema_migrations sessions])
113
110
  end
114
111
  end
115
112
 
116
- it "should not exclude sessions table from result if asked to exclude nothing" do
113
+ it 'should not exclude sessions table from result if asked to exclude nothing' do
117
114
  DumpRake::Env.with_env(:tables => '-') do
118
115
  expect(tables_to_dump).to eq(%w[first second schema_info schema_migrations sessions])
119
116
  end
120
117
  end
121
118
 
122
- it "should not exclude schema tables" do
119
+ it 'should not exclude schema tables' do
123
120
  DumpRake::Env.with_env(:tables => '-second,schema_info,schema_migrations') do
124
121
  expect(tables_to_dump).to eq(%w[first schema_info schema_migrations sessions])
125
122
  end
126
123
  end
127
124
 
128
- it "should not exclude schema tables ever if asked to dump only certain tables" do
125
+ it 'should not exclude schema tables ever if asked to dump only certain tables' do
129
126
  DumpRake::Env.with_env(:tables => 'second') do
130
127
  expect(tables_to_dump).to eq(%w[second schema_info schema_migrations])
131
128
  end
@@ -133,50 +130,47 @@ describe TableManipulation do
133
130
  end
134
131
  end
135
132
 
136
- describe "table_row_count" do
137
- it "should ruturn row count for table" do
133
+ describe 'table_row_count' do
134
+ it 'should ruturn row count for table' do
138
135
  expect(ActiveRecord::Base.connection).to receive(:select_value).with("SELECT COUNT(*) FROM #{quote_table_name('first')}").and_return('666')
139
136
  expect(table_row_count('first')).to eq(666)
140
137
  end
141
138
  end
142
139
 
143
- describe "table_chunk_size" do
144
- it "should return chunk_size based on estimated average for row size" do
140
+ describe 'table_chunk_size' do
141
+ it 'should return chunk_size based on estimated average for row size' do
145
142
  expect(self).to receive(:table_columns).with('first').and_return(
146
143
  [double(:column, :type => :integer, :limit => nil)] * 3 +
147
144
  [double(:column, :type => :string, :limit => nil)] * 3 +
148
- [double(:column, :type => :text, :limit => nil)]
149
- )
150
- expect(table_chunk_size('first')).to satisfy { |n|
145
+ [double(:column, :type => :text, :limit => nil)])
146
+ expect(table_chunk_size('first')).to satisfy{ |n|
151
147
  (TableManipulation::CHUNK_SIZE_MIN..TableManipulation::CHUNK_SIZE_MAX).include?(n)
152
148
  }
153
149
  end
154
150
 
155
- it "should not return value less than CHUNK_SIZE_MIN" do
151
+ it 'should not return value less than CHUNK_SIZE_MIN' do
156
152
  expect(self).to receive(:table_columns).with('first').and_return(
157
- [double(:column, :type => :text, :limit => nil)] * 100
158
- )
153
+ [double(:column, :type => :text, :limit => nil)] * 100)
159
154
  expect(table_chunk_size('first')).to eq(TableManipulation::CHUNK_SIZE_MIN)
160
155
  end
161
156
 
162
- it "should not return value more than CHUNK_SIZE_MAX" do
157
+ it 'should not return value more than CHUNK_SIZE_MAX' do
163
158
  expect(self).to receive(:table_columns).with('first').and_return(
164
- [double(:column, :type => :boolean, :limit => 1)] * 10
165
- )
159
+ [double(:column, :type => :boolean, :limit => 1)] * 10)
166
160
  expect(table_chunk_size('first')).to eq(TableManipulation::CHUNK_SIZE_MAX)
167
161
  end
168
162
  end
169
163
 
170
- describe "table_columns" do
171
- it "should return table column definitions" do
164
+ describe 'table_columns' do
165
+ it 'should return table column definitions' do
172
166
  columns = [double(:column), double(:column), double(:column)]
173
167
  expect(ActiveRecord::Base.connection).to receive(:columns).with('first').and_return(columns)
174
168
  expect(table_columns('first')).to eq(columns)
175
169
  end
176
170
  end
177
171
 
178
- describe "table_has_primary_column?" do
179
- it "should return true only if table has column with name id and type :integer" do
172
+ describe 'table_has_primary_column?' do
173
+ it 'should return true only if table has column with name id and type :integer' do
180
174
  expect(self).to receive(:table_primary_key).at_least(3).times.and_return('id')
181
175
 
182
176
  expect(self).to receive(:table_columns).with('first').and_return([double(:column, :name => 'id', :type => :integer), double(:column, :name => 'title', :type => :integer)])
@@ -190,14 +184,14 @@ describe TableManipulation do
190
184
  end
191
185
  end
192
186
 
193
- describe "table_primary_key" do
194
- it "should return id" do
187
+ describe 'table_primary_key' do
188
+ it 'should return id' do
195
189
  expect(table_primary_key('first')).to eq('id')
196
190
  expect(table_primary_key(nil)).to eq('id')
197
191
  end
198
192
  end
199
193
 
200
- describe "each_table_row" do
194
+ describe 'each_table_row' do
201
195
  before do
202
196
  @row_count = 550
203
197
  @rows = Array.new(@row_count){ |i| {'id' => "#{i + 1}"} }
@@ -212,7 +206,7 @@ describe TableManipulation do
212
206
  expect(i).to eq(@row_count)
213
207
  end
214
208
 
215
- it "should get rows in chunks if table has primary column and chunk size is less than row count" do
209
+ it 'should get rows in chunks if table has primary column and chunk size is less than row count' do
216
210
  expect(self).to receive(:table_has_primary_column?).with('first').and_return(true)
217
211
  expect(self).to receive(:table_chunk_size).with('first').and_return(100)
218
212
  quoted_table_name = quote_table_name('first')
@@ -233,24 +227,24 @@ describe TableManipulation do
233
227
  verify_getting_rows
234
228
  end
235
229
 
236
- it "should get rows in one pass if table has primary column but chunk size is not less than row count" do
230
+ it 'should get rows in one pass if table has primary column but chunk size is not less than row count' do
237
231
  expect(self).to receive(:table_has_primary_column?).with('first').and_return(true)
238
232
  expect(self).to receive(:table_chunk_size).with('first').and_return(3_000)
239
233
  verify_getting_rows_in_one_pass
240
234
  end
241
235
 
242
- it "should get rows in one pass if table has no primary column" do
236
+ it 'should get rows in one pass if table has no primary column' do
243
237
  expect(self).to receive(:table_has_primary_column?).with('first').and_return(false)
244
238
  expect(self).to_not receive(:table_chunk_size)
245
239
  verify_getting_rows_in_one_pass
246
240
  end
247
241
  end
248
242
 
249
- describe "select_all_by_sql" do
250
- it "should return all rows returned by database" do
243
+ describe 'select_all_by_sql' do
244
+ it 'should return all rows returned by database' do
251
245
  rows = [double(:row), double(:row), double(:row)]
252
- expect(ActiveRecord::Base.connection).to receive(:select_all).with("SELECT * FROM abc WHERE x = y").and_return(rows)
253
- expect(select_all_by_sql("SELECT * FROM abc WHERE x = y")).to eq(rows)
246
+ expect(ActiveRecord::Base.connection).to receive(:select_all).with('SELECT * FROM abc WHERE x = y').and_return(rows)
247
+ expect(select_all_by_sql('SELECT * FROM abc WHERE x = y')).to eq(rows)
254
248
  end
255
249
  end
256
250
  end