Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

add stylus template support #553

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants

I'm having tests failing, but it seems to be due to:

  1. missed libraries,
  2. and some other thing I don't imagine (\a character),

see:

  1) Error:
test_can_be_used_in_a_nested_fashion_for_partials_and_whatnot(BlueClothTest):
Encoding::InvalidByteSequenceError: "\xF9" on UTF-8

  2) Failure:
test_renders_inline_markdown_strings(BlueClothTest) [/Users/adiaz/projects/Rubymine/sinatra-stylus/sinatra/test/markdown_test.rb:26]:
<"<h1>Hiya</h1>"> expected but was
<"<h1>Hiya</h1>\a">.

  3) Failure:
test_renders_with_file_layouts(BlueClothTest) [/Users/adiaz/projects/Rubymine/sinatra-stylus/sinatra/test/markdown_test.rb:55]:
<"ERB Layout!<p>Hello World</p>"> expected but was
<"ERB Layout!<p>Hello World</p>ap/">.

  4) Failure:
test_renders_with_inline_layouts(BlueClothTest) [/Users/adiaz/projects/Rubymine/sinatra-stylus/sinatra/test/markdown_test.rb:47]:
<"THIS.IS.<P>SPARTA</P>!"> expected but was
<"THIS.IS.<P>SPARTA</P>\a!">.

  5) Failure:
test_renders_inline_Stylus_strings(StylusTest) [/Users/adiaz/projects/Rubymine/sinatra-stylus/sinatra/test/stylus_test.rb:23]:
waiting response on how stylus can be rendered inline

960 tests, 1774 assertions, 4 failures, 1 errors, 0 skips

I put a pending message in fifth failure

This pull request fails (merged b18310f into 91bce0b).

This pull request fails (merged b18310f into 91bce0b).

Owner

rkh commented Aug 31, 2012

Any news on "waiting response on how stylus can be rendered inline"? I'd like to include this in 1.4.0.

Owner

rkh commented Dec 13, 2012

Could you remove that assert false, '...' part and add Stylus to the Gemfile, so we see this running on Travis?

@lucasmazza lucasmazza and 1 other commented on an outdated diff Dec 17, 2012

test/stylus_test.rb
+ rescue Exception
+ raise LoadError, 'unable to find Stylus compiler'
+ end
+
+ class StylusTest < Test::Unit::TestCase
+ def stylus_app(options = {}, &block)
+ mock_app do
+ set :views, File.dirname(__FILE__) + '/views'
+ set(options)
+ get('/', &block)
+ end
+ get '/'
+ end
+
+ it 'renders inline Stylus strings' do
+ stylus_app { stylus "a margin auto\n" }
@lucasmazza

lucasmazza Dec 17, 2012

I think that this string should be "a\n margin auto\n", with the proper linebreak after the selector, just like a similar test in scss_test.rb

@juanpastas

juanpastas Dec 17, 2012

I run tests again. I have not noticed that I am skipping tests, terminal says

unable to find Stylus compiler: skipping stylus tests

I don't understand how to correctly configure load path for testing. I have stylus gem installed, and I have tried

ruby -I~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/stylus-0.6.2 test/stylus_test.rb
ruby test/stylus_test.rb

Can you help me with this? I'm also having same problem with v8, bluecloth, and red carpet.

@lucasmazza

lucasmazza Dec 17, 2012

After cloning your fork I just did bundle install && rake test. Some unrelated tests were skipped, but Stylus one were executed since stylus is on the Gemfile. You could try that and see if it works for you.

@juanpastas

juanpastas Dec 17, 2012

My bundle is complete... hmmm, don't know what could be happening

@juanpastas

juanpastas Dec 17, 2012

hmmm, lol I don't have nodejs installed, that fixed the problem :p

@lucasmazza

lucasmazza Dec 17, 2012

See my comment on line 8 that's directly related to your problem.

@lucasmazza lucasmazza and 1 other commented on an outdated diff Dec 17, 2012

test/stylus_test.rb
@@ -0,0 +1,89 @@
+require File.expand_path('../helper', __FILE__)
+
+begin
+ require 'stylus'
+
+ begin
+ Stylus.compile '1'
+ rescue Exception
@lucasmazza

lucasmazza Dec 17, 2012

stylus throws a RuntimeError when the runtime isn't available, so I think would be better to rescue for just RuntimeError instead of Exception here, so it won't swallow any other kind of setup issue that might appear.

@juanpastas

juanpastas Dec 17, 2012

Modified to RuntimeError, but raising LoadError, is this OK?

@lucasmazza

lucasmazza Dec 17, 2012

I'm not sure if this intermediate rescue is necessary, since being part of the bundle won't issue any LoadError anytime soon.

@juanpastas

juanpastas Dec 17, 2012

Maybe message should say something related to the error I was having... nodejs not installed.

add \n in inline template in stylus test
change caught error when loading stylus
Owner

rkh commented Feb 25, 2013

This needs a rebase.

Owner

rkh commented Feb 26, 2013

This seems to depend on Tilt edge. :(

Owner

rkh commented Feb 26, 2013

Let me correct this: It does not seem Tilt has any support for stylus. How did you run the tests?

Owner

rkh commented Feb 26, 2013

Ah, found it. I need to load both stylus and stylus/tilt.

@rkh rkh closed this in 1d48a75 Feb 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment