docbrown/spec/models/poll_spec.rb
Ben Halpern 8ae057b06e
Beta polls feature (admin use only for now) (#3176)
* Initial poll features

* Add basic poll functionality

* Finish (maybe) beta poll functionality
2019-06-15 17:33:30 -04:00

17 lines
506 B
Ruby

require "rails_helper"
RSpec.describe Poll, type: :model do
let(:article) { create(:article, featured: true) }
let(:poll) { create(:poll, article_id: article.id) }
it "limits length of prompt" do
long_string = "0" * 200
poll.prompt_markdown = long_string
expect(poll).not_to be_valid
end
it "creates options from input" do
poll = create(:poll, article_id: article.id, poll_options_input_array: %w[hello goodbye heyheyhey])
expect(poll.poll_options.size).to eq(3)
end
end