fixed markdown issues with reshares; removed puts from specs

This commit is contained in:
danielgrippi 2012-01-07 17:33:16 -08:00
parent 687eb7ba0b
commit e928cc805a
5 changed files with 34 additions and 16 deletions

View file

@ -62,13 +62,8 @@ class Post < ActiveRecord::Base
self.class.name
end
def raw_message
""
end
def mentioned_people
[]
end
def raw_message; ""; end
def mentioned_people; []; end
# gives the last three comments on the post
def last_three_comments

View file

@ -30,7 +30,11 @@ class Reshare < Post
end
def raw_message
self.root ? root.raw_message : ""
self.root ? root.raw_message : super
end
def mentioned_people
self.root ? root.mentioned_people : super
end
def receive(recipient, sender)

View file

@ -37,7 +37,7 @@
<% } %>
<% } %>
<%= root.text %>
<%= text %>
<% if(o_embed_cache) { %>
<%= root.o_embed_cache.posts.data.html %>

View file

@ -16,7 +16,6 @@ describe PublicsController do
get :host_meta
response.should be_success
response.body.should =~ /webfinger/
puts "Saving host-meta fixture to #{fixture_path}"
save_fixture(response.body, "host-meta", fixture_path)
end
end

View file

@ -15,6 +15,7 @@ describe("app.views.Post", function(){
this.collection = new app.collections.Stream(posts);
this.statusMessage = this.collection.models[0];
this.reshare = this.collection.models[1];
})
it("displays a reshare count", function(){
@ -72,6 +73,17 @@ describe("app.views.Post", function(){
expect(view.$("h1:contains(parties)")).not.toExist();
expect(view.$("a:contains('#parties')")).toExist();
})
it("works on reshares", function(){
this.statusMessage.set({text: "I love #parties"})
var reshare = new app.models.Reshare(factory.post({
text : this.statusMessage.get("text"),
root : this.statusMessage
}))
var view = new app.views.Post({model : reshare}).render();
expect(view.$("a:contains('#parties')").attr('href')).toBe('/tags/parties')
})
})
context("changes mention markup to links", function(){
@ -87,23 +99,31 @@ describe("app.views.Post", function(){
diaspora_id : "bob@example.com",
id : "666"
})
this.statusMessage.set({mentioned_people : [this.alice, this.bob]})
this.statusMessage.set({text: "hey there @{Alice Smith; alice@example.com} and @{Bob Grimm; bob@example.com}"})
})
it("links to the mentioned person's page", function(){
this.statusMessage.set({mentioned_people : [this.alice]})
this.statusMessage.set({text: "sup, @{Alice Smith; alice@example.com}?"})
var view = new app.views.Post({model : this.statusMessage}).render();
expect(view.$("a:contains('Alice Smith')").attr('href')).toBe('/people/555')
})
it("matches all mentions", function(){
this.statusMessage.set({mentioned_people : [this.alice, this.bob]})
this.statusMessage.set({text: "hey there @{Alice Smith; alice@example.com} and @{Bob Grimm; bob@example.com}"})
var view = new app.views.Post({model : this.statusMessage}).render();
expect(view.$("a.mention").length).toBe(2)
})
it("works on reshares", function(){
var reshare = new app.models.Reshare(factory.post({
text : this.statusMessage.get("text"),
mentioned_people : this.statusMessage.get("mentioned_people"),
root : this.statusMessage
}))
var view = new app.views.Post({model : reshare}).render();
expect(view.$("a.mention").length).toBe(2)
})
})
context("user not signed in", function(){