reactrb 0.8.5 → 0.8.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 432c02f2ff9fa554e3a2a1204eeefd0ddc298517
4
- data.tar.gz: 5f3cab14f2b427012679be08b6b9be74b83906ae
3
+ metadata.gz: dd3c6c8b1cf5d2a684020ee3d320fe5ac37c340e
4
+ data.tar.gz: ac90157aefeb57a7ffecaa3d9f5782ed1d428de7
5
5
  SHA512:
6
- metadata.gz: cc66ddd5e99becd6dc75cd130905f2b5c4eeff00801a9381244286d22a501500b48be20bae15f3fdd8f1310e94025dd0de4578d734e8ed7a922badad2c1300a0
7
- data.tar.gz: f88436fe6d61c23e9cd66db39a2bf76c72cf4c9cbd9e6f9c9f59b8e96b49f921278c64719f70364089174dc175ea3e6597ec28599d626c9b227186adad87fe46
6
+ metadata.gz: f0d14776cd42b7b2fac9a03da13f9132e27fe544b6f323e8f92ee947f02e253c1a226ef813e73cbdcb56d89446694caa1bca7082b5c88d22c48bae6ab48736a5
7
+ data.tar.gz: fad34a83a2b6ab81438e8e0db5c37590c07a18bcaa27afeb1e10bfefe4784cffee4ae31f500515e86150b076b9ef82f6227b2a7238c32694af976fd80ac61652
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file starting with v0.8.6.
4
+ This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
+
6
+ Changes are grouped as follows:
7
+ - **Added** for new features.
8
+ - **Changed** for changes in existing functionality.
9
+ - **Deprecated** for once-stable features removed in upcoming releases.
10
+ - **Removed** for deprecated features removed in this release.
11
+ - **Fixed** for any bug fixes.
12
+ - **Security** to invite users to upgrade in case of vulnerabilities.
13
+
14
+ <!--
15
+ Whitespace conventions:
16
+ - 4 spaces before ## titles
17
+ - 2 spaces before ### titles
18
+ - 1 spaces before normal text
19
+ -->
20
+
21
+
22
+
23
+
24
+ ## [0.8.6] - 2016-06-30
25
+
26
+
27
+ ### Fixed
28
+
29
+ - Method missing within a component was being reported as `incorrect const name` (#151)
@@ -83,13 +83,20 @@ module React
83
83
  private
84
84
 
85
85
  def find_component(name)
86
- scopes = "#{self.class.name}".split('::').inject([Module]) do |nesting, next_const|
86
+ component = lookup_const(name)
87
+ if component && !component.method_defined?(:render)
88
+ raise "#{name} does not appear to be a react component."
89
+ end
90
+ component
91
+ end
92
+
93
+ def lookup_const(name)
94
+ return nil unless name =~ /^[A-Z]/
95
+ scopes = self.class.name.to_s.split('::').inject([Module]) do |nesting, next_const|
87
96
  nesting + [nesting.last.const_get(next_const)]
88
97
  end.reverse
89
- scope = scopes.detect { |s| s.const_defined?(name) } || return
90
- component = scope.const_get(name)
91
- return component if component.method_defined?(:render)
92
- raise "#{name} does not appear to be a react component."
98
+ scope = scopes.detect { |s| s.const_defined?(name) }
99
+ scope.const_get(name) if scope
93
100
  end
94
101
  end
95
102
  end
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = '0.8.5'
2
+ VERSION = '0.8.6'
3
3
  end
@@ -153,6 +153,18 @@ describe 'the React DSL' do
153
153
  .to raise_error('Comp does not appear to be a react component.')
154
154
  end
155
155
 
156
+ it 'raises a method missing error' do
157
+ stub_const 'Foo', Class.new(React::Component::Base)
158
+ Foo.class_eval do
159
+ backtrace :none
160
+ render do
161
+ _undefined_method
162
+ end
163
+ end
164
+ expect { React.render_to_static_markup(React.create_element(Foo)) }
165
+ .to raise_error(NoMethodError)
166
+ end
167
+
156
168
  it "will treat the component class name as a first class component name" do
157
169
  stub_const 'Mod::Bar', Class.new
158
170
  Mod::Bar.class_eval do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chang
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-29 00:00:00.000000000 Z
13
+ date: 2016-06-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: opal
@@ -232,6 +232,7 @@ files:
232
232
  - ".gitignore"
233
233
  - ".rubocop.yml"
234
234
  - ".travis.yml"
235
+ - CHANGELOG.md
235
236
  - Gemfile
236
237
  - LICENSE
237
238
  - README.md