Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about test case #72

Open
khiav223577 opened this issue Oct 19, 2016 · 5 comments · May be fixed by #74
Open

Question about test case #72

khiav223577 opened this issue Oct 19, 2016 · 5 comments · May be fixed by #74

Comments

@khiav223577
Copy link

The following is one of the test cases:

test '#split_string_into_rules containing media queries' do
  has_media = "a{foo:bar;}@media print{b{baz:qux;}c{quux:corge;}}d{grault:garply;}"
  assert_equal ["a{foo:bar;}", "@media print{b{baz:qux;}", "c{quux:corge;}", "}", "d{grault:garply;}"], CssSplitter::Splitter.split_string_into_rules(has_media)
end

why the result is

["a{foo:bar;}", "@media print{b{baz:qux;}", "c{quux:corge;}", "}", "d{grault:garply;}"]

instead of

["a{foo:bar;}", "@media print{b{baz:qux;}c{quux:corge;}}", "d{grault:garply;}"]

Is "}" a rule?

@jhilden
Copy link
Contributor

jhilden commented Oct 19, 2016

Unfortunately I have no idea. I guess one would need to look in the PR/git history to see if there is any information on that and maybe mention the authors of the code in question here.

@khiav223577
Copy link
Author

It seems that this test case exists for a long time from #30 (by @Umofomia).

And the method split_string_into_rules was: (https://github.com/zweilove/css_splitter/pull/30/files#diff-3b8e9eb6bd155a54d793812eccd2b02cR15)

def self.split_string_into_rules(css_string)
  strip_comments(css_string).chomp.scan /[^}]*}/
end

Apparently, It didn't handle @media Rule.

I think this test case should be fixed.

@khiav223577
Copy link
Author

Another question:
what is the right way to run the test?
I run rake test then get

29 tests, 32 assertions, 5 failures, 3 errors, 0 skips

I run rake test TEST=test/unit/splitter_test.rb then get

20 tests, 26 assertions, 0 failures, 0 errors, 0 skips

@jhilden
Copy link
Contributor

jhilden commented Oct 21, 2016

I guess rake test is the way to go. This is also what travis is running.

For me the tests are all passing. I can only imagine that it is because of some gem version. I tried it with Ruby 2.3.0 and the following gems https://gist.github.com/jhilden/1e02368a79d03a1576816cb6e1e695eb

@khiav223577
Copy link
Author

khiav223577 commented Oct 22, 2016

I guess it is because of rails version, sass version or default config setting.
The following is my gems' version and the error messages:
Ruby 2.1.8
Sass 3.3.14
Rails 3.2.22.5
Sprockets 2.2.3

test/css_splitter_test.rb:
2016-10-22 6 01 40
test/unit/helpers/css_splitter/application_helper_test.rb:
2016-10-22 5 55 40
2016-11-07 4 10 11

I do have fixed the first (#73), but I have no idea how to fix the second

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants