質問

I have the following failing unit test;

it "should handle white space" do
  Sanitize.clean('   ').should == ''
end

Which fails because the result of Sanitize.clean(' ') is ' ' not ''.

The same test on other people's machines works fine, which lead me down the track of maybe an incorrect gem being installed but I have checked and everyone is running the same gemfile.lock which is running Sanitize 2.0.3 which in turn is running Nokogiri 1.5.5

The version of Ruby (including patch) is the same at 1.9.3-p392, the only difference is that most people are running the tests on Ubuntu machines and I am running them on Mac OS X.

Other tests that use Sanitize pass fine, things like stripping out unwanted tags and allowing other tags, it is only whitespace that is falling over.

This led me to then think that maybe it was something to do with the encoding or the characters I am sending through, perhaps on my system the whitespace character isn't coming across as one that Sanitize can understand? I have no idea how to verify this.

Any help on what my next step should be would be greatly appreciated.

役に立ちましたか?

解決 2

Unfortunately the answer to this question isn't very helpful, but when I was reviewing this with another member of staff we decided that the test that needed this code wasn't a valid test, so we removed it.

他のヒント

Sanitize uses libxml2, is this library installed on your system ? You can install it with brew install libxml2.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top