Sha256: 53257402fdfdcd6a7529014b4151d916eb5fe77bcc403686a3d4b612f6c1d08c
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require "spec_helper" describe TriviaCrack::Parsers::QuestionParser do describe ".parse" do subject { TriviaCrack::Parsers::QuestionParser.parse raw_data } context 'when given data without an image' do let(:raw_data) { SpecData.get_json "question.json" } it { is_expected.to be_a TriviaCrack::Question } its(:type) { is_expected.to be :normal } its(:media_type) { is_expected.to be :normal } its(:text) { is_expected.to eq "Who recorded this album?" } its(:correct_answer) { is_expected.to be 3 } its(:category) { is_expected.to be :entertainment } its(:answers) { is_expected.to contain_exactly "Creedence Cleawater Revival", "Bob Marley", "blink-182", "Jimmy Hendrix" } end context 'when given data with an image' do let(:raw_data) { SpecData.get_json "question_image.json" } it { is_expected.to be_a TriviaCrack::Question } its(:type) { is_expected.to be :normal } its(:media_type) { is_expected.to be :image } its(:text) { is_expected.to eq "Who recorded this album?" } its(:correct_answer) { is_expected.to be 3 } its(:category) { is_expected.to be :entertainment } its(:image_url) { is_expected.to eq "http://qimg.preguntados.com/ENT_3028" } its(:answers) { is_expected.to contain_exactly "Creedence Cleawater Revival", "Bob Marley", "blink-182", "Jimmy Hendrix" } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
triviacrack-0.6.0 | spec/parsers/question_parser_spec.rb |