Skip to content

Commit

Permalink
BUGFIX: broken specs after pulling in closed poll stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Apr 9, 2014
1 parent 90a26dd commit 93d7908
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/poll/spec/poll_plugin/poll_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
topic.save
expect(PollPlugin::Poll.new(post).is_poll?).to be_false
I18n.expects(:t).with('poll.prefix').returns("Poll\\s?:")
I18n.expects(:t).with('poll.closed_prefix').returns("Closed Poll\\s?:")
expect(PollPlugin::Poll.new(post).is_poll?).to be_true
end

Expand Down Expand Up @@ -59,10 +60,17 @@
end

it "should serialize correctly" do
poll.serialize(user).should eq({options: poll.details, selected: nil})
poll.serialize(user).should eq({options: poll.details, selected: nil, closed: false})
poll.set_vote!(user, "Onodera")
poll.serialize(user).should eq({options: poll.details, selected: "Onodera"})
poll.serialize(nil).should eq({options: poll.details, selected: nil})
poll.serialize(user).should eq({options: poll.details, selected: "Onodera", closed: false})
poll.serialize(nil).should eq({options: poll.details, selected: nil, closed: false})

topic.title = "Closed Poll: my poll"
topic.save

post.topic.reload
poll = PollPlugin::Poll.new(post)
poll.serialize(nil).should eq({options: poll.details, selected: nil, closed: true})
end

it "should serialize to nil if there are no poll options" do
Expand Down

0 comments on commit 93d7908

Please sign in to comment.