RSpec - A JSON text must at least contain two octets
Two failing specs after upgrading rspec-rails (2.5.2 -> 3.8.1)
and capybara (2.18.0 -> 3.10.1)
:
Not really sure what's going on here. Looks like text in the expectation is being truncated?!?
let(:story_attributes) do
title: 'Edited title',
description: 'Edited location',
start_year: '2001',
start_month: 'December',
start_day: '5',
end_year: '2001',
end_month: 'October',
end_day: '10',
is_range: true,
cover_image:
url: 'http://placehold.it/edited.png'
end
...
within 'section.story-cover' do
expect(page).to have_text 'Edited title'
expect(page).to have_text 'Edited location'
expect(page).to have_text 'December 5th - October 10th, 2001'
end
In first failed example (below) "Edited location" is being truncated.
In second example expect(page).to have_text 'Edited title Edited location'
where only "Edited titlenEdited locat" is found.
Then there's this "JSON text must at least contain two octets" issue which may or may not be related but this used to pass before upgrading rspec-rails & capybara.ds
Thoughts?
RSpec Failures:
1) Story editing published edit story
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited location" in "Edited titlenLyla HoegerEditedDecember 5th - October 10th, 2001Download"
# ./spec/features/stories/editing_spec.rb:86:in `block (4 levels) in <top (required)>'
2) Story editing private private story should be read after editing
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited title Edited location" in "Edited titlenEdited locat"
# ./spec/features/stories/editing_spec.rb:115:in `block (4 levels) in <top (required)>'
ruby-on-rails json rspec capybara rspec-rails
add a comment |
Two failing specs after upgrading rspec-rails (2.5.2 -> 3.8.1)
and capybara (2.18.0 -> 3.10.1)
:
Not really sure what's going on here. Looks like text in the expectation is being truncated?!?
let(:story_attributes) do
title: 'Edited title',
description: 'Edited location',
start_year: '2001',
start_month: 'December',
start_day: '5',
end_year: '2001',
end_month: 'October',
end_day: '10',
is_range: true,
cover_image:
url: 'http://placehold.it/edited.png'
end
...
within 'section.story-cover' do
expect(page).to have_text 'Edited title'
expect(page).to have_text 'Edited location'
expect(page).to have_text 'December 5th - October 10th, 2001'
end
In first failed example (below) "Edited location" is being truncated.
In second example expect(page).to have_text 'Edited title Edited location'
where only "Edited titlenEdited locat" is found.
Then there's this "JSON text must at least contain two octets" issue which may or may not be related but this used to pass before upgrading rspec-rails & capybara.ds
Thoughts?
RSpec Failures:
1) Story editing published edit story
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited location" in "Edited titlenLyla HoegerEditedDecember 5th - October 10th, 2001Download"
# ./spec/features/stories/editing_spec.rb:86:in `block (4 levels) in <top (required)>'
2) Story editing private private story should be read after editing
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited title Edited location" in "Edited titlenEdited locat"
# ./spec/features/stories/editing_spec.rb:115:in `block (4 levels) in <top (required)>'
ruby-on-rails json rspec capybara rspec-rails
Please provide your specs and the related code, not everyone is familiarized with changes so specific between versions. Thank you!
– byrdEmmanuel
Nov 9 at 21:21
I added some more details but the expectation is pretty vanilla, in my opinion. Something else is going on, I think?!?
– Meltemi
Nov 9 at 22:00
add a comment |
Two failing specs after upgrading rspec-rails (2.5.2 -> 3.8.1)
and capybara (2.18.0 -> 3.10.1)
:
Not really sure what's going on here. Looks like text in the expectation is being truncated?!?
let(:story_attributes) do
title: 'Edited title',
description: 'Edited location',
start_year: '2001',
start_month: 'December',
start_day: '5',
end_year: '2001',
end_month: 'October',
end_day: '10',
is_range: true,
cover_image:
url: 'http://placehold.it/edited.png'
end
...
within 'section.story-cover' do
expect(page).to have_text 'Edited title'
expect(page).to have_text 'Edited location'
expect(page).to have_text 'December 5th - October 10th, 2001'
end
In first failed example (below) "Edited location" is being truncated.
In second example expect(page).to have_text 'Edited title Edited location'
where only "Edited titlenEdited locat" is found.
Then there's this "JSON text must at least contain two octets" issue which may or may not be related but this used to pass before upgrading rspec-rails & capybara.ds
Thoughts?
RSpec Failures:
1) Story editing published edit story
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited location" in "Edited titlenLyla HoegerEditedDecember 5th - October 10th, 2001Download"
# ./spec/features/stories/editing_spec.rb:86:in `block (4 levels) in <top (required)>'
2) Story editing private private story should be read after editing
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited title Edited location" in "Edited titlenEdited locat"
# ./spec/features/stories/editing_spec.rb:115:in `block (4 levels) in <top (required)>'
ruby-on-rails json rspec capybara rspec-rails
Two failing specs after upgrading rspec-rails (2.5.2 -> 3.8.1)
and capybara (2.18.0 -> 3.10.1)
:
Not really sure what's going on here. Looks like text in the expectation is being truncated?!?
let(:story_attributes) do
title: 'Edited title',
description: 'Edited location',
start_year: '2001',
start_month: 'December',
start_day: '5',
end_year: '2001',
end_month: 'October',
end_day: '10',
is_range: true,
cover_image:
url: 'http://placehold.it/edited.png'
end
...
within 'section.story-cover' do
expect(page).to have_text 'Edited title'
expect(page).to have_text 'Edited location'
expect(page).to have_text 'December 5th - October 10th, 2001'
end
In first failed example (below) "Edited location" is being truncated.
In second example expect(page).to have_text 'Edited title Edited location'
where only "Edited titlenEdited locat" is found.
Then there's this "JSON text must at least contain two octets" issue which may or may not be related but this used to pass before upgrading rspec-rails & capybara.ds
Thoughts?
RSpec Failures:
1) Story editing published edit story
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited location" in "Edited titlenLyla HoegerEditedDecember 5th - October 10th, 2001Download"
# ./spec/features/stories/editing_spec.rb:86:in `block (4 levels) in <top (required)>'
2) Story editing private private story should be read after editing
Failure/Error: JSON.parse(response.body)
JSON::ParserError:
A JSON text must at least contain two octets!
# ./app/services/converter/image_service.rb:36:in `post_to_filepicker'
# ./app/services/converter/image_service.rb:18:in `convert_format'
# ./app/services/converter/image_service.rb:11:in `block in convert'
# ./app/services/converter/image_service.rb:10:in `each'
# ./app/services/converter/image_service.rb:10:in `convert'
# ./app/models/images/image.rb:5:in `convert'
# ./app/models/images/image.rb:20:in `enqueue_conversion'
# ./app/services/story/updating_service.rb:14:in `update'
# ./app/controllers/stories_controller.rb:58:in `update'
# ------------------
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Edited title Edited location" in "Edited titlenEdited locat"
# ./spec/features/stories/editing_spec.rb:115:in `block (4 levels) in <top (required)>'
ruby-on-rails json rspec capybara rspec-rails
ruby-on-rails json rspec capybara rspec-rails
edited Nov 9 at 21:52
asked Nov 9 at 21:19
Meltemi
21k42169257
21k42169257
Please provide your specs and the related code, not everyone is familiarized with changes so specific between versions. Thank you!
– byrdEmmanuel
Nov 9 at 21:21
I added some more details but the expectation is pretty vanilla, in my opinion. Something else is going on, I think?!?
– Meltemi
Nov 9 at 22:00
add a comment |
Please provide your specs and the related code, not everyone is familiarized with changes so specific between versions. Thank you!
– byrdEmmanuel
Nov 9 at 21:21
I added some more details but the expectation is pretty vanilla, in my opinion. Something else is going on, I think?!?
– Meltemi
Nov 9 at 22:00
Please provide your specs and the related code, not everyone is familiarized with changes so specific between versions. Thank you!
– byrdEmmanuel
Nov 9 at 21:21
Please provide your specs and the related code, not everyone is familiarized with changes so specific between versions. Thank you!
– byrdEmmanuel
Nov 9 at 21:21
I added some more details but the expectation is pretty vanilla, in my opinion. Something else is going on, I think?!?
– Meltemi
Nov 9 at 22:00
I added some more details but the expectation is pretty vanilla, in my opinion. Something else is going on, I think?!?
– Meltemi
Nov 9 at 22:00
add a comment |
1 Answer
1
active
oldest
votes
One of the big changes between Capybara 2.x and 3.x was that in Capybara 3.x text is returned as closely to what is displayed as possible. This means that line feeds are now included in the returned text when they would display to the user - https://github.com/teamcapybara/capybara/blob/master/UPGRADING.md. You either need to change your expected text to "Edited titlenEdited location" at spec/features/stories/editing_spec.rb:115 or if you don't care about the linefeeds you can use the :normalize_ws
option => expect(page).to have_text("Edited title Edited location", normalize_ws: true)
This is great! Thanks! Where is the definitive source for documentation for using RSpec & Capybara? I never would have foundnormalize_ws
in my searching for a solution to this problem.
– Meltemi
Nov 9 at 22:59
1
The docs - rubydoc.info/github/teamcapybara/capybara are the best source for info - and the History.md file for a list of the changes. There's a gitter page linked from the github for discussing things or just post here and someone will answer within a reasonable time.
– Thomas Walpole
Nov 9 at 23:53
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233401%2frspec-a-json-text-must-at-least-contain-two-octets%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
One of the big changes between Capybara 2.x and 3.x was that in Capybara 3.x text is returned as closely to what is displayed as possible. This means that line feeds are now included in the returned text when they would display to the user - https://github.com/teamcapybara/capybara/blob/master/UPGRADING.md. You either need to change your expected text to "Edited titlenEdited location" at spec/features/stories/editing_spec.rb:115 or if you don't care about the linefeeds you can use the :normalize_ws
option => expect(page).to have_text("Edited title Edited location", normalize_ws: true)
This is great! Thanks! Where is the definitive source for documentation for using RSpec & Capybara? I never would have foundnormalize_ws
in my searching for a solution to this problem.
– Meltemi
Nov 9 at 22:59
1
The docs - rubydoc.info/github/teamcapybara/capybara are the best source for info - and the History.md file for a list of the changes. There's a gitter page linked from the github for discussing things or just post here and someone will answer within a reasonable time.
– Thomas Walpole
Nov 9 at 23:53
add a comment |
One of the big changes between Capybara 2.x and 3.x was that in Capybara 3.x text is returned as closely to what is displayed as possible. This means that line feeds are now included in the returned text when they would display to the user - https://github.com/teamcapybara/capybara/blob/master/UPGRADING.md. You either need to change your expected text to "Edited titlenEdited location" at spec/features/stories/editing_spec.rb:115 or if you don't care about the linefeeds you can use the :normalize_ws
option => expect(page).to have_text("Edited title Edited location", normalize_ws: true)
This is great! Thanks! Where is the definitive source for documentation for using RSpec & Capybara? I never would have foundnormalize_ws
in my searching for a solution to this problem.
– Meltemi
Nov 9 at 22:59
1
The docs - rubydoc.info/github/teamcapybara/capybara are the best source for info - and the History.md file for a list of the changes. There's a gitter page linked from the github for discussing things or just post here and someone will answer within a reasonable time.
– Thomas Walpole
Nov 9 at 23:53
add a comment |
One of the big changes between Capybara 2.x and 3.x was that in Capybara 3.x text is returned as closely to what is displayed as possible. This means that line feeds are now included in the returned text when they would display to the user - https://github.com/teamcapybara/capybara/blob/master/UPGRADING.md. You either need to change your expected text to "Edited titlenEdited location" at spec/features/stories/editing_spec.rb:115 or if you don't care about the linefeeds you can use the :normalize_ws
option => expect(page).to have_text("Edited title Edited location", normalize_ws: true)
One of the big changes between Capybara 2.x and 3.x was that in Capybara 3.x text is returned as closely to what is displayed as possible. This means that line feeds are now included in the returned text when they would display to the user - https://github.com/teamcapybara/capybara/blob/master/UPGRADING.md. You either need to change your expected text to "Edited titlenEdited location" at spec/features/stories/editing_spec.rb:115 or if you don't care about the linefeeds you can use the :normalize_ws
option => expect(page).to have_text("Edited title Edited location", normalize_ws: true)
answered Nov 9 at 22:42
Thomas Walpole
29.8k32647
29.8k32647
This is great! Thanks! Where is the definitive source for documentation for using RSpec & Capybara? I never would have foundnormalize_ws
in my searching for a solution to this problem.
– Meltemi
Nov 9 at 22:59
1
The docs - rubydoc.info/github/teamcapybara/capybara are the best source for info - and the History.md file for a list of the changes. There's a gitter page linked from the github for discussing things or just post here and someone will answer within a reasonable time.
– Thomas Walpole
Nov 9 at 23:53
add a comment |
This is great! Thanks! Where is the definitive source for documentation for using RSpec & Capybara? I never would have foundnormalize_ws
in my searching for a solution to this problem.
– Meltemi
Nov 9 at 22:59
1
The docs - rubydoc.info/github/teamcapybara/capybara are the best source for info - and the History.md file for a list of the changes. There's a gitter page linked from the github for discussing things or just post here and someone will answer within a reasonable time.
– Thomas Walpole
Nov 9 at 23:53
This is great! Thanks! Where is the definitive source for documentation for using RSpec & Capybara? I never would have found
normalize_ws
in my searching for a solution to this problem.– Meltemi
Nov 9 at 22:59
This is great! Thanks! Where is the definitive source for documentation for using RSpec & Capybara? I never would have found
normalize_ws
in my searching for a solution to this problem.– Meltemi
Nov 9 at 22:59
1
1
The docs - rubydoc.info/github/teamcapybara/capybara are the best source for info - and the History.md file for a list of the changes. There's a gitter page linked from the github for discussing things or just post here and someone will answer within a reasonable time.
– Thomas Walpole
Nov 9 at 23:53
The docs - rubydoc.info/github/teamcapybara/capybara are the best source for info - and the History.md file for a list of the changes. There's a gitter page linked from the github for discussing things or just post here and someone will answer within a reasonable time.
– Thomas Walpole
Nov 9 at 23:53
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233401%2frspec-a-json-text-must-at-least-contain-two-octets%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please provide your specs and the related code, not everyone is familiarized with changes so specific between versions. Thank you!
– byrdEmmanuel
Nov 9 at 21:21
I added some more details but the expectation is pretty vanilla, in my opinion. Something else is going on, I think?!?
– Meltemi
Nov 9 at 22:00