page_record 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- page_record (0.2.0)
4
+ page_record (0.2.1)
5
5
  activesupport
6
6
  capybara (~> 2.1.0)
7
7
 
@@ -156,9 +156,14 @@ private
156
156
 
157
157
  # @private
158
158
  def self.set_type_name(base)
159
- @host_name = base.to_s.gsub('Page', '')
160
- @type = @host_name.underscore
161
- @host_class = @host_name.constantize
159
+ begin
160
+ @host_name = base.to_s.gsub('Page', '')
161
+ @type = @host_name.underscore
162
+ @host_class = @host_name.constantize
163
+ rescue NameError
164
+ @host_name = ''
165
+ @host_class = ''
166
+ end
162
167
  end
163
168
 
164
169
  # @private
@@ -1,3 +1,3 @@
1
1
  module PageRecord
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -17,11 +17,19 @@ describe PageRecord::Base do
17
17
  [ 'id' , 'name', 'points', 'ranking', 'goals']
18
18
  end
19
19
  end
20
- class CamelCasePage < PageRecord::Base; end
21
20
  end
22
21
 
22
+ after do
23
+ Object.send(:remove_const, :CamelCasePage)
24
+ end
25
+
26
+
23
27
  context "no type given" do
24
28
 
29
+ before do
30
+ class CamelCasePage < PageRecord::Base; end
31
+ end
32
+
25
33
  it "returns the internal type of the class " do
26
34
  expect( CamelCasePage.type).to eq "camel_case"
27
35
  end
@@ -170,13 +178,14 @@ describe PageRecord::Base do
170
178
 
171
179
  describe ".host_class" do
172
180
 
181
+ before do
182
+ class FunnyRecord < PageRecord::Base
183
+ host_class Team
184
+ end
185
+ end
186
+
173
187
  context "with a parameter" do
174
188
 
175
- before do
176
- class FunnyRecord < PageRecord::Base
177
- host_class Team
178
- end
179
- end
180
189
 
181
190
  # TODO refactor test
182
191
  subject {FunnyRecord.new(1) }
@@ -536,5 +545,18 @@ describe PageRecord::Base do
536
545
  pending
537
546
  end
538
547
 
548
+ describe "found bugs" do
549
+
550
+ describe "class name contains word page but doens't exist" do
551
+
552
+ it "doesn'throw exception" do
553
+ expect { class RubbishPage < PageRecord::Base; end }.not_to raise_error
554
+ end
555
+
556
+ end
557
+
558
+
559
+ end
560
+
539
561
 
540
562
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: