make rspec and jasmine pass with the new code

This commit is contained in:
Jonne Haß 2014-06-01 17:44:36 +02:00
parent 38e5ae2b73
commit d070f19243
6 changed files with 13 additions and 12 deletions

View file

@ -9,7 +9,7 @@ class ReportController < ApplicationController
use_bootstrap_for :index
def index
@reports = Report.where(reviewed: false).all
@reports = Report.where(reviewed: false)
end
def update

View file

@ -1,7 +1,7 @@
class Poll < ActiveRecord::Base
include Diaspora::Federated::Base
include Diaspora::Guid
attr_accessible :question, :poll_answers
belongs_to :status_message
has_many :poll_answers
has_many :poll_participations
@ -14,7 +14,7 @@ class Poll < ActiveRecord::Base
validate :enough_poll_answers
validates :question, presence: true
self.include_root_in_json = false
def enough_poll_answers

View file

@ -49,12 +49,12 @@ describe('app.views.Bookmarklet', function() {
});
it('keeps the publisher disabled after successful post creation', function() {
jasmine.Ajax.useMock();
jasmine.Ajax.install();
init_bookmarklet(test_data);
spec.content().find('form').submit();
mostRecentAjaxRequest().response({
jasmine.Ajax.requests.mostRecent().response({
status: 200, // success!
responseText: "{}"
});

View file

@ -23,13 +23,13 @@ describe("app.views.Poll", function(){
describe("vote", function(){
it("checks the ajax call for voting", function(){
spyOn($, "ajax");
jasmine.Ajax.install();
var answer = this.view.poll.poll_answers[0];
var poll = this.view.poll;
this.view.vote(answer.id);
var obj = JSON.parse($.ajax.mostRecentCall.args[0].data);
var obj = jasmine.Ajax.requests.mostRecent().params);
expect(obj.poll_id).toBe(poll.poll_id);
expect(obj.poll_answer_id).toBe(answer.id);
})

View file

@ -1,5 +1,6 @@
describe("Locator", function(){
navigator.geolocation['getCurrentPosition'] = function(myCallback){
navigator.geolocation = {};
navigator.geolocation.getCurrentPosition = function(myCallback){
lat = 1;
lon = 2;
position = { coords: { latitude: lat, longitude: lon} }

View file

@ -115,17 +115,17 @@ describe Diaspora::MessageRenderer do
it "should leave tags intact" do
expect(
message("I love #markdown").markdownified
).to match %r{<a href="/tags/markdown" class="tag">#markdown</a>}
).to match %r{<a class="tag" href="/tags/markdown">#markdown</a>}
end
it 'should leave multi-underscore tags intact' do
expect(
message("Here is a #multi_word tag").markdownified
).to match %r{Here is a <a href="/tags/multi_word" class="tag">#multi_word</a> tag}
).to match %r{Here is a <a class="tag" href="/tags/multi_word">#multi_word</a> tag}
expect(
message("Here is a #multi_word_tag yo").markdownified
).to match %r{Here is a <a href="/tags/multi_word_tag" class="tag">#multi_word_tag</a> yo}
).to match %r{Here is a <a class="tag" href="/tags/multi_word_tag">#multi_word_tag</a> yo}
end
it "should leave mentions intact" do
@ -147,7 +147,7 @@ describe Diaspora::MessageRenderer do
it 'should process text with both a hashtag and a link' do
expect(
message("Test #tag?\nhttps://joindiaspora.com\n").markdownified
).to eq %{<p>Test <a href="/tags/tag" class="tag">#tag</a>?<br>\n<a href="https://joindiaspora.com" target="_blank">https://joindiaspora.com</a></p>\n}
).to eq %{<p>Test <a class="tag" href="/tags/tag">#tag</a>?<br>\n<a href="https://joindiaspora.com" target="_blank">https://joindiaspora.com</a></p>\n}
end
it 'should process text with a header' do