Question

The first one prints error infomations as follow:

Failures:

1) UnitShip 测试增删改: Create should be successful Failure/Error: unit_ship = UnitShip.create(DataGenerator::Master.unit_ship) Psych::SyntaxError: couldn't parse YAML at line 14 column 14 # ./spec/support/data_generator/master.rb:9:in unit_ship' # ./spec/models/unit_ship_spec.rb:8:inblock (3 levels) in '

2) UnitShip 测试增删改: 删除 should be successful. Failure/Error: unit_ship = UnitShip.create(DataGenerator::Master.unit_ship) Psych::SyntaxError: couldn't parse YAML at line 14 column 14 # ./spec/support/data_generator/master.rb:9:in unit_ship' # ./spec/models/unit_ship_spec.rb:28:inblock (3 levels) in '

Finished in 1.65 seconds 13 examples, 2 failures

Failed examples:

rspec ./spec/models/unit_ship_spec.rb:7 # UnitShip 测试增删改: Create should be successful rspec ./spec/models/unit_ship_spec.rb:27 # UnitShip 测试增删改: 删除 should be successful.

The another prints error infomations as follow:

Failures:

1) Unit Update should not be successful Failure/Error: @fabric = FactoryGirl.build(:fabric) ActiveRecord::RecordInvalid: 校验失败: 编号 已经被使用 # ./spec/models/unit_spec.rb:23:in `block (3 levels) in '

2) Unit Destroy should not be successful Failure/Error: @fabric = FactoryGirl.build(:fabric) ActiveRecord::RecordInvalid: 校验失败: 编号 已经被使用 # ./spec/models/unit_spec.rb:38:in `block (3 levels) in '

Finished in 1.16 seconds 13 examples, 2 failures

Failed examples:

rspec ./spec/models/unit_spec.rb:21 # Unit Update should not be successful rspec ./spec/models/unit_spec.rb:36 # Unit Destroy should not be successful

====================================================================== This first one is incorrect, the second one is correct .

why?

please help me . thanks !

Was it helpful?

Solution

It has to do with the version of the Yaml parser your Ruby is compiled against.

Your second machine is using Syck, while your first one is using Psych. To force the first one to use Syck, put this in your application.rb:

YAML::ENGINE.yamler='syck'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top