MS DC fix tests

This commit is contained in:
Dennis Collinson 2012-03-22 15:20:55 -07:00
parent 8c640b179e
commit 11eb1eb7d8
7 changed files with 24 additions and 23 deletions

View file

@ -13,6 +13,9 @@ Diaspora::Application.routes.draw do
resources :participations, :only => [:create, :destroy, :index]
resources :comments, :only => [:new, :create, :destroy, :index]
end
match "/framer" => redirect("/posts/new")
get 'p/:id' => 'posts#show', :as => 'short_post'
# roll up likes into a nested resource above
resources :comments, :only => [:create, :destroy] do
@ -32,7 +35,6 @@ Diaspora::Application.routes.draw do
get "commented" => "streams#commented", :as => "commented_stream"
get "aspects" => "streams#aspects", :as => "aspects_stream"
resources :aspects do
put :toggle_contact_visibility
end

View file

@ -39,7 +39,3 @@ When /^I should see "([^"]*)" aspect unselected$/ do |aspect_name|
page.has_css?("li[data-aspect_id='#{aspect.id}']:not(.active)").should be_true
end
end
When /^"([^"]*)" should render with the "([^"]*)" template$/ do |post_text, template_name|
within find_post_by_text(post_text) { assert_template(template_name) }
end

View file

@ -16,4 +16,10 @@ end
Then /^I should have (\d+) nsfw posts$/ do |num_posts|
all(".nsfw-shield").size.should == num_posts.to_i
end
When /^I click the show page link for "([^"]*)"$/ do |post_text|
within(find_post_by_text(post_text)) do
find("time").click
end
end

View file

@ -25,18 +25,14 @@ def finalize_frame
click_button "done"
end
def post_div
find(".post")
end
def within_frame_preview
within post_div do
within find(".post") do
yield
end
end
def assert_template(template_name)
post_div["data-template"].should == template_name
def assert_post_renders_with(template_name)
find(".post")["data-template"].should == template_name
end
When /^I trumpet$/ do
@ -106,6 +102,6 @@ When /^I select the template "([^"]*)"$/ do |template_name|
select template_name, :from => 'template'
end
Then /^I should see an "([^"]*)" framer preview$/ do |template_name|
assert_template(template_name)
Then /^the post should (?:still |)be rendered as a "([^"]*)"$/ do |template_name|
assert_post_renders_with(template_name)
end

View file

@ -44,11 +44,11 @@ Feature: Creating a new post
And I upload a fixture picture with filename "button.gif"
And I start the framing process
Then I should see "This is hella customized" in the framer preview
# And I should see the image "button.gif"
# And I should see the image "button.gif" background
When I select the template "note"
Then I should see an "note" framer preview
Then the post should be rendered as a "note"
When I finalize my frame
And I go to "/stream"
Then "This is hella customized" should be post 1
And "This is hella customized" should render with the "note" template
When I click the show page link for "This is hella customized"
Then the post should still be rendered as a "note"

View file

@ -24,17 +24,18 @@ app.pages.Framer = app.views.Base.extend({
var templateType = this.model.get("templateName")
var postView = new app.views.Post({
this._postView = new app.views.Post({
model : this.model,
className : templateType + " post loaded",
templateName : "post-viewer/content/" + templateType,
attributes : {"data-template" : templateType}
});
postView.feedbackView = new Backbone.View
this._postView.feedbackView = new Backbone.View
this.model.authorIsNotCurrentUser = function(){ return false }
return postView
return this._postView
},
saveFrame : function(){

View file

@ -10,7 +10,7 @@ describe("app.pages.Framer", function(){
});
it("passes the model down to the post view", function(){
expect(this.page.postView.model).toBe(app.frame)
expect(this.page._postView.model).toBe(app.frame)
});
describe("rendering", function(){
@ -24,4 +24,4 @@ describe("app.pages.Framer", function(){
expect(app.frame.save).toHaveBeenCalled();
});
});
});
});