datagrid 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,7 @@ describe Datagrid::Helper do
77
77
  end
78
78
 
79
79
  it "should support giving assets explicitly" do
80
- Entry.create!(entry.attributes)
80
+ Entry.create!(entry.attributes.except("id"))
81
81
  datagrid_table = subject.datagrid_table(grid, [entry])
82
82
 
83
83
  expect(datagrid_table).to match_css_pattern({
@@ -415,8 +415,8 @@ describe Datagrid::Helper do
415
415
  object = OrderedGrid.new(:descending => true, :order => :category)
416
416
  expect(subject.datagrid_order_for(object, object.column_by_name(:category))).to equal_to_dom(<<-HTML)
417
417
  <div class="order">
418
- <a href="/location?ordered_grid%5Bdescending%5D=false&amp;ordered_grid%5Border%5D=category" class="asc">&uarr;</a>
419
- <a href="/location?ordered_grid%5Bdescending%5D=true&amp;ordered_grid%5Border%5D=category" class="desc">&darr;</a>
418
+ <a class="asc" href="/location?ordered_grid%5Bdescending%5D=false&amp;ordered_grid%5Border%5D=category">&uarr;</a>
419
+ <a class="desc" href="/location?ordered_grid%5Bdescending%5D=true&amp;ordered_grid%5Border%5D=category">&darr;</a>
420
420
  </div>
421
421
  HTML
422
422
  end
@@ -611,7 +611,7 @@ describe Datagrid::Helper do
611
611
  end
612
612
  expect(subject.datagrid_header(grid)).to equal_to_dom(<<HTML)
613
613
  <tr><th class="category ordered asc">Category<div class="order">
614
- <a href="/location?grid%5Bdescending%5D=false&amp;grid%5Border%5D=category" class="asc">&uarr;</a><a href="/location?grid%5Bdescending%5D=true&amp;grid%5Border%5D=category" class="desc">&darr;</a>
614
+ <a class="asc" href="/location?grid%5Bdescending%5D=false&amp;grid%5Border%5D=category">&uarr;</a><a class="desc" href="/location?grid%5Bdescending%5D=true&amp;grid%5Border%5D=category">&darr;</a>
615
615
  </div>
616
616
  </th></tr>
617
617
  HTML
@@ -1,9 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
- require 'mongoid'
4
- require 'mongo_mapper'
5
-
6
-
7
3
 
8
4
  begin
9
5
  Bundler.setup(:default, :development)
@@ -20,7 +16,13 @@ require "active_record"
20
16
  require 'action_view'
21
17
  require "rails"
22
18
  require "mongoid"
23
- require "mongo_mapper"
19
+ begin
20
+ require 'mongo_mapper'
21
+ rescue LoadError
22
+ end
23
+
24
+
25
+
24
26
  require 'datagrid'
25
27
  begin
26
28
  require 'ruby-debug'
@@ -45,21 +47,30 @@ NO_MONGO = ENV['NO_MONGO']
45
47
 
46
48
  begin
47
49
  Mongoid.load_configuration({
48
- "sessions" =>
50
+ "clients" =>
49
51
  {
50
- "default" =>
52
+ "default" =>
51
53
  {
52
54
  "hosts" => ["localhost:27017"],
53
55
  "database" =>"datagrid_mongoid",
54
56
  "autocreate_indexes" => true,
55
57
  "logger" => nil,
58
+ "options" => {
59
+ "connect_timeout" => 2,
60
+ wait_queue_timeout: 2
61
+ }
56
62
  }
57
63
  }
58
64
  })
59
- MongoMapper.connection = Mongo::Connection.new('localhost', 27017)
60
- MongoMapper.database = "datagrid_mongo_mapper"
61
65
 
62
- rescue Mongo::ConnectionFailure
66
+ Mongoid.client(:default).collections # check mongo connection
67
+
68
+ if defined?(MongoMapper)
69
+ MongoMapper.connection = Mongo::Connection.new('localhost', 27017)
70
+ MongoMapper.database = "datagrid_mongo_mapper"
71
+ end
72
+
73
+ rescue Mongo::Error::NoServerAvailable
63
74
  message = "Didn't find mongodb at localhost:27017."
64
75
  if NO_MONGO
65
76
  warn("MONGODB WARNING: #{message}. Skipping Mongoid and Mongomapper tests.")
@@ -78,7 +89,7 @@ RSpec.configure do |config|
78
89
  SequelEntry.where.delete
79
90
  unless NO_MONGO
80
91
  MongoidEntry.delete_all
81
- MongoMapperEntry.delete_all
92
+ MongoMapperEntry.delete_all if defined?(MongoMapperEntry)
82
93
  end
83
94
 
84
95
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
3
- ActiveRecord::Base.configurations = true
3
+ #ActiveRecord::Base.configurations = true
4
4
 
5
5
  ActiveRecord::Base.logger = TEST_LOGGER
6
6
 
@@ -24,7 +24,7 @@ ActiveRecord::Schema.define(:version => 1) do
24
24
 
25
25
  create_table :groups do |t|
26
26
  t.string :name
27
- t.float :rating
27
+ t.float :rating
28
28
  t.timestamps
29
29
  end
30
30
 
@@ -1,32 +1,32 @@
1
- require "rubygems"
1
+ if defined?(MongoMapper)
2
2
 
3
- class MongoMapperEntry
4
- include MongoMapper::Document
3
+ class MongoMapperEntry
4
+ include MongoMapper::Document
5
5
 
6
- key :group_id, Integer
7
- key :name, String
8
- key :category, String
9
- key :disabled, Boolean, :default => false
10
- key :confirmed, Boolean, :default => false
11
- key :shipping_date, Time
12
- timestamps!
6
+ key :group_id, Integer
7
+ key :name, String
8
+ key :category, String
9
+ key :disabled, Boolean, :default => false
10
+ key :confirmed, Boolean, :default => false
11
+ key :shipping_date, Time
12
+ timestamps!
13
13
 
14
- end
14
+ end
15
15
 
16
- class MongoMapperGrid
17
- include ::Datagrid
16
+ class MongoMapperGrid
17
+ include ::Datagrid
18
18
 
19
- scope do
20
- MongoMapperEntry
21
- end
19
+ scope do
20
+ MongoMapperEntry
21
+ end
22
22
 
23
- filter :name
24
- integer_range_filters(:group_id, {:default => 0}, {:default => 100})
25
- filter :disabled, :xboolean
23
+ filter :name
24
+ integer_range_filters(:group_id, {:default => 0}, {:default => 100})
25
+ filter :disabled, :xboolean
26
26
 
27
- column :name
28
- column :group_id
29
- column :disabled
27
+ column :name
28
+ column :group_id
29
+ column :disabled
30
30
 
31
+ end
31
32
  end
32
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-25 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.22.2
19
+ version: '4.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
- version: 3.2.22.2
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -126,30 +126,16 @@ dependencies:
126
126
  name: mongoid
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '='
130
- - !ruby/object:Gem::Version
131
- version: 3.1.7
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - '='
137
- - !ruby/object:Gem::Version
138
- version: 3.1.7
139
- - !ruby/object:Gem::Dependency
140
- name: mongo_mapper
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
129
+ - - ">="
144
130
  - !ruby/object:Gem::Version
145
- version: 0.13.0
131
+ version: '0'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
- - - "~>"
136
+ - - ">="
151
137
  - !ruby/object:Gem::Version
152
- version: 0.13.0
138
+ version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: bson
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -313,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
299
  version: '0'
314
300
  requirements: []
315
301
  rubyforge_project:
316
- rubygems_version: 2.6.7
302
+ rubygems_version: 2.5.1
317
303
  signing_key:
318
304
  specification_version: 4
319
305
  summary: Ruby gem to create datagrids