Comments (15)
This strikes me as requiring live debugging to identify the cause. Can you prepare a minimal sample project? Unless @wireframe has an idea?
from jasmine-rails.
can you check your asset pipeline settings for development/test? specifically, the assets.debug
flag. try flipping it to false (the default) and re-run the specs
config.assets.debug = false
from jasmine-rails.
@wireframe I set config.assets.debug
to false in my development environment and it fixed the problem! This begs two questions:
- Shouldn't the test environment be in effect when running Jasmine specs, not the development environment?
- Why does having this setting set to true (the default on a newly generated 3.2.13 app) cause this problem?
from jasmine-rails.
Both very valid questions.
from jasmine-rails.
So turning of assets debugging in dev mode is pretty annoying. I confirmed that explicitly running the specs in test mode, eg:
RAILS_ENV=test rake spec:javascript
fixes the 'run twice' behavior. This is most likely because asset debugging is disabled by default in test mode.
Having the specs run in test mode by default makes a lot of sense to me. Alternatively, fixing how jasmine-specs.js
is generated also makes a lot of sense to me.
Thoughts?
from jasmine-rails.
Either way, 👍 to flipping test mode on for that rake task.
from jasmine-rails.
Can anyone find a decent example of how one's supposed to favor the test environment from a rake task that inherits from :environment? I couldn't find one.
from jasmine-rails.
I'm still seeing this issue in v0.4.5. It works fine if I use RAILS_ENV=test rake spec:javascript
, but not if I don't set the environment to test
i.e. I'm not convinced 7f00190 fixed the problem. Note that I'm using Rails v4.0.0.
from jasmine-rails.
Yep, this is a regression caused by how Rails 4 preloads the Rails environment for every executed task. I've asked several people and received zero productive comments on how to work around it.
For now, just use RAILS_ENV=test. If we can't find a way to wrangle the Rails environment, I think a new release should probably just eschew rake altogether and include a CLI bin for jasmine-rails.
from jasmine-rails.
Cool. Thanks for letting me know.
from jasmine-rails.
I'm still pretty stumped about how to flip Rails environment after Rake starts. I've heard from multiple people that it's not possible anymore.
Please Internet, you're my only hope
from jasmine-rails.
@searls I think the key to fixing this issue is to not depend on :environment
in the rake task declaration. The environment
task is triggered to load the current Rails environment (which defaults to development) and afterwards, you won't be able to change back into test mode.
Instead, you should be able to define the task with no dependencies, manually set the RAILS_ENV
environment variable, and then programmatically trigger the :environment
task to load the rest of the Rails environment.
Here's a gist as an example, but I have not tested it yet to confirm that it works as expected.
https://gist.github.com/wireframe/6581238
from jasmine-rails.
I spiked this but what I found was that rails' env is preloaded as of rails 4 in such a way that it doesn't matter whether we depend on the :environment. Did you test your spike to verify it works on rails 4?
On Mon, Sep 16, 2013 at 10:18 AM, Ryan Sonnek [email protected]
wrote:
@searls I think the key to fixing this issue is to not depend on
:environment
in the rake task declaration. Theenvironment
task is triggered to load the current Rails environment (which defaults to development) and afterwards, you won't be able to change back into test mode.
Instead, you should be able to define the task with no dependencies, manually set theRAILS_ENV
environment variable, and then programmatically trigger the:environment
task to load the rest of the Rails environment.
Here's a gist as an example, but I have not tested it yet to confirm that it works as expected.https://gist.github.com/wireframe/6581238
Reply to this email directly or view it on GitHub:
#28 (comment)
from jasmine-rails.
@wireframe @searls I just tested the gist mentioned above in a rails 4 app and it didn't worked 😞
from jasmine-rails.
Indeed, in Rails 4, Rake always has Rails loaded before tasks run. :-(
On Mon, Oct 21, 2013 at 9:41 AM, Danilo Sousa [email protected]
wrote:
@wireframe @searls I just tested the gist mentioned above in a rails 4 app and it didn't worked 😞
Reply to this email directly or view it on GitHub:
#28 (comment)
from jasmine-rails.
Related Issues (20)
- Add Rails 5 to the build matrix
- "PhantomJS has crashed" problem when upgrade to PhantomJS 2.1.1 HOT 18
- "phantom_options: --debug=true" fails with "Invalid values for 'debug' option." HOT 3
- How to make jasmine-rails find jasmine HOT 1
- Error when running tests HOT 2
- `rake spec:javascript` shouldn't short circuit a chain of rake commands
- $templateCache not being hit HOT 1
- Using angular 1.3.2 will break jasmine specs HOT 1
- Empty spec causes infinite loop hang HOT 1
- Trouble with running tests in terminal HOT 5
- Error executing command HOT 2
- Out of date monkey patch on `compute_asset_path` breaks minitest on Rails 5.0.1+
- Running rake spec:javascript from terminal does not find specs HOT 3
- Suggest that users run with RAILS_ENV=test HOT 2
- SPEC= not working
- commandline skips all specs HOT 6
- Sourcemap on /assets/jasmine-specs.js HOT 1
- Update comment in offline_asset_paths.rb for newer versions of Rails HOT 4
- Add support for jasmine-core 3.x.x? HOT 3
- PhantomJs has been archived - Replace it with Headless Chrome HOT 2
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 jasmine-rails.