Comments (9)
stub_const
has always had lingering issues. I've never been a fan of it in my tests though so it hasn't been a problem for me. Frankly, I can't imagine it becoming much of a priority as long as Opal's underlying constant issue is there.
If I get some time I'll try and see what's going on. Most of my energy right now though has to go towards getting RSpec 3.4 working.
from opal-rspec.
no big deal but do you have any recommendation for fixing that spec? What I am doing now is to just declare TestMod123::Bar outside the spec, and let it sit there... These test structures go back to @zetachang, so perhaps there is a better way?
from opal-rspec.
Any reason they have to be assigned a constant? Why not do it like this?
it "can add class names by the haml .class notation" do
mod123 = Class.new(React::Component::Base) do
collect_other_params_as :attributes
def render
"a man walks into a bar".span(attributes)
end
end
foo = Class.new(React::Component::Base) do
def render
mod123().the_class
end
end
expect(React.render_to_static_markup(React.create_element(foo))).to eq('<span class="the-class">a man walks into a bar</span>')
end
from opal-rspec.
Most cases yes, but specifically I need to test that TestMod123::Bar works... so I need at least one test that I do assign to a constant...
from opal-rspec.
Why though? Is this to test the React display name stuff?
from opal-rspec.
No because in the dsl you can do this:
def render
TestMod123::Bar()
end
from opal-rspec.
OK I see. You're testing the equivalent of this: http://ruby-doc.org/core-2.2.3/Kernel.html#method-i-String
from opal-rspec.
I think doing this with any type of anonymous class will be difficult. Even in MRI, included
doesn't know the name of the class yet. Getting opal and opal-rspec to do something different could be quite tricky and probably not desirable.
code:
module Foo
def self.included(base)
puts "we are #{base}"
end
end
class Bar
include Foo
end
Toodles = Class.new do
include Foo
end
MRI output:
we are Bar
we are #<Class:0x007fc08b886a78>
I think even with vanilla RSpec on MRI, you wouldn't get this to work without hacking/calling included again, etc.
I think creating a normal fixture class outside of the test might be your best option. Might want to make the behavior fail gracefully in case someone wants to use an anonymous class for a React component.
from opal-rspec.
missing/broken features are now tracked by spec filters on master
from opal-rspec.
Related Issues (20)
- Compiler/Line Number Metadata HOT 4
- Performance Improvement Ideas HOT 4
- issues with opal 0.10.0 HOT 4
- Results Reporting Sync/Async HOT 1
- filter_run_excluding not working? HOT 1
- how to require gem or a source file ? HOT 5
- Opal-Master Compatibility
- Sprockets HOT 1
- Support random order HOT 2
- Opal::RSpec::RakeTask HOT 4
- `expect_any_instance_of` is not working when using opal master HOT 5
- Trying to run phantomjs or in-browser tests throws Sprockets::FileNotFound HOT 3
- Get ` cannot load such file -- rake` when run test in browser. HOT 2
- Could not found jquery when use node as task runner. HOT 1
- spec not worked with opal 0.11. (chrome headless) HOT 11
- Unable to require 'nodejs' in spec HOT 2
- uninitialized constant OPAL_PLATFORM HOT 8
- Headless Chrome support HOT 3
- Can you release a new version? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opal-rspec.