diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb index 58770a555..fca442f40 100644 --- a/features/step_definitions/aspects_steps.rb +++ b/features/step_definitions/aspects_steps.rb @@ -39,3 +39,7 @@ 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 \ No newline at end of file diff --git a/features/step_definitions/trumpeter_steps.rb b/features/step_definitions/trumpeter_steps.rb index 96908ff57..fc717ecf4 100644 --- a/features/step_definitions/trumpeter_steps.rb +++ b/features/step_definitions/trumpeter_steps.rb @@ -25,18 +25,26 @@ def finalize_frame click_button "done" end +def post_div + find(".post") +end + def within_frame_preview - within ".post-view .post" do + within post_div do yield end end +def assert_template(template_name) + post_div["data-template"].should == template_name +end + When /^I trumpet$/ do visit new_post_path end When /^I write "([^"]*)"$/ do |text| - fill_in :text, :with => text + fill_in 'text', :with => text end Then /I mention "([^"]*)"$/ do |text| @@ -90,7 +98,14 @@ Then /^"([^"]*)" should have (\d+) pictures$/ do |post_text, number_of_pictures| find_post_by_text(post_text).all(".photo_attachments img").size.should == number_of_pictures.to_i end - Then /^I should see "([^"]*)" in the framer preview$/ do |post_text| within_frame_preview { page.should have_content(post_text) } +end + +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) end \ No newline at end of file diff --git a/features/trumpeter.feature b/features/trumpeter.feature index 8bc295765..e2ff6dc07 100644 --- a/features/trumpeter.feature +++ b/features/trumpeter.feature @@ -44,7 +44,10 @@ 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 + When I select the template "awesome" + Then I should see an "awesome" framer preview 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 "awesome" template diff --git a/public/javascripts/app/templates/framer.handlebars b/public/javascripts/app/templates/framer.handlebars index 0be8d4488..ca3e884d3 100644 --- a/public/javascripts/app/templates/framer.handlebars +++ b/public/javascripts/app/templates/framer.handlebars @@ -1,2 +1,5 @@ - +