Skip to content
Extraits de code Groupes Projets
Valider d070f192 rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

make rspec and jasmine pass with the new code

parent 38e5ae2b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -9,7 +9,7 @@ class ReportController < ApplicationController ...@@ -9,7 +9,7 @@ class ReportController < ApplicationController
use_bootstrap_for :index use_bootstrap_for :index
def index def index
@reports = Report.where(reviewed: false).all @reports = Report.where(reviewed: false)
end end
def update def update
......
class Poll < ActiveRecord::Base class Poll < ActiveRecord::Base
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Guid include Diaspora::Guid
attr_accessible :question, :poll_answers
belongs_to :status_message belongs_to :status_message
has_many :poll_answers has_many :poll_answers
has_many :poll_participations has_many :poll_participations
...@@ -14,7 +14,7 @@ class Poll < ActiveRecord::Base ...@@ -14,7 +14,7 @@ class Poll < ActiveRecord::Base
validate :enough_poll_answers validate :enough_poll_answers
validates :question, presence: true validates :question, presence: true
self.include_root_in_json = false self.include_root_in_json = false
def enough_poll_answers def enough_poll_answers
......
...@@ -49,12 +49,12 @@ describe('app.views.Bookmarklet', function() { ...@@ -49,12 +49,12 @@ describe('app.views.Bookmarklet', function() {
}); });
it('keeps the publisher disabled after successful post creation', function() { it('keeps the publisher disabled after successful post creation', function() {
jasmine.Ajax.useMock(); jasmine.Ajax.install();
init_bookmarklet(test_data); init_bookmarklet(test_data);
spec.content().find('form').submit(); spec.content().find('form').submit();
mostRecentAjaxRequest().response({ jasmine.Ajax.requests.mostRecent().response({
status: 200, // success! status: 200, // success!
responseText: "{}" responseText: "{}"
}); });
......
...@@ -23,13 +23,13 @@ describe("app.views.Poll", function(){ ...@@ -23,13 +23,13 @@ describe("app.views.Poll", function(){
describe("vote", function(){ describe("vote", function(){
it("checks the ajax call for voting", function(){ it("checks the ajax call for voting", function(){
spyOn($, "ajax"); jasmine.Ajax.install();
var answer = this.view.poll.poll_answers[0]; var answer = this.view.poll.poll_answers[0];
var poll = this.view.poll; var poll = this.view.poll;
this.view.vote(answer.id); 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_id).toBe(poll.poll_id);
expect(obj.poll_answer_id).toBe(answer.id); expect(obj.poll_answer_id).toBe(answer.id);
}) })
......
describe("Locator", function(){ describe("Locator", function(){
navigator.geolocation['getCurrentPosition'] = function(myCallback){ navigator.geolocation = {};
navigator.geolocation.getCurrentPosition = function(myCallback){
lat = 1; lat = 1;
lon = 2; lon = 2;
position = { coords: { latitude: lat, longitude: lon} } position = { coords: { latitude: lat, longitude: lon} }
......
...@@ -115,17 +115,17 @@ describe Diaspora::MessageRenderer do ...@@ -115,17 +115,17 @@ describe Diaspora::MessageRenderer do
it "should leave tags intact" do it "should leave tags intact" do
expect( expect(
message("I love #markdown").markdownified 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 end
it 'should leave multi-underscore tags intact' do it 'should leave multi-underscore tags intact' do
expect( expect(
message("Here is a #multi_word tag").markdownified 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( expect(
message("Here is a #multi_word_tag yo").markdownified 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 end
it "should leave mentions intact" do it "should leave mentions intact" do
...@@ -147,7 +147,7 @@ describe Diaspora::MessageRenderer do ...@@ -147,7 +147,7 @@ describe Diaspora::MessageRenderer do
it 'should process text with both a hashtag and a link' do it 'should process text with both a hashtag and a link' do
expect( expect(
message("Test #tag?\nhttps://joindiaspora.com\n").markdownified 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 end
it 'should process text with a header' do it 'should process text with a header' do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter