diff --git a/features/step_definitions/trumpeter_steps.rb b/features/step_definitions/trumpeter_steps.rb index a3b32a59f..3464df209 100644 --- a/features/step_definitions/trumpeter_steps.rb +++ b/features/step_definitions/trumpeter_steps.rb @@ -5,3 +5,26 @@ end When /^I write "([^"]*)"$/ do |text| fill_in :text, :with => text end + +def aspects_dropdown + find(".dropdown-toggle") +end + +def select_from_dropdown(option_text, dropdown) + dropdown.click + within ".dropdown-menu" do + link = find("a:contains('#{option_text}')") + link.should be_visible + link.click + end + #assert dropdown text is link +end + +When /^I select "([^"]*)" in my aspects dropdown$/ do |title| + within ".aspect_selector" do + select_from_dropdown(title, aspects_dropdown) + end +end +Then /^"([^"]*)" should be a (limited|public) post in my stream$/ do |post_text, scope| + find_post_by_text(post_text).find(".post_scope").text.should =~ /#{scope}/i +end \ No newline at end of file diff --git a/features/trumpeter.feature b/features/trumpeter.feature index 17b07e384..d60399688 100644 --- a/features/trumpeter.feature +++ b/features/trumpeter.feature @@ -4,14 +4,19 @@ Feature: Creating a new post Given a user with username "bob" And I sign in as "bob@bob.bob" And I trumpet - And I write "Rectangles are awesome" Scenario: Posting a public message + And I write "Rectangles are awesome" + When I select "Public" in my aspects dropdown When I press "Share" When I go to "/stream" Then I should see "Rectangles are awesome" as the first post in my stream + And "Rectangles are awesome" should be a public post in my stream Scenario: Posting to Aspects - When I select "generic" in my aspects dropdown + And I write "This is super skrunkle" + When I select "All Aspects" in my aspects dropdown And I press "Share" - Then I should see "Rectangles are awesome" as a limited post in my stream + When I go to "/stream" + Then I should see "This is super skrunkle" as the first post in my stream + Then "This is super skrunkle" should be a limited post in my stream diff --git a/public/javascripts/app/forms/post_form_view.js b/public/javascripts/app/forms/post_form.js similarity index 86% rename from public/javascripts/app/forms/post_form_view.js rename to public/javascripts/app/forms/post_form.js index 3c2a84edb..1f2a1fc56 100644 --- a/public/javascripts/app/forms/post_form_view.js +++ b/public/javascripts/app/forms/post_form.js @@ -7,7 +7,7 @@ app.forms.Post = app.forms.Base.extend({ formAttrs : { ".text" : "text", -// ".aspect_ids" : "aspect_ids" + "input.aspect_ids" : "aspect_ids" }, initialize : function(){ diff --git a/public/javascripts/app/models/status_message.js b/public/javascripts/app/models/status_message.js index 50190883d..e87cdda7f 100644 --- a/public/javascripts/app/models/status_message.js +++ b/public/javascripts/app/models/status_message.js @@ -4,8 +4,11 @@ app.models.StatusMessage = app.models.Post.extend({ }, mungeAndSave : function(){ - var mungedAttrs = {status_message : _.clone(this.attributes), aspect_ids : ["public"]} - + var mungedAttrs = {status_message : _.clone(this.attributes), aspect_ids : mungeAspects(this.get("aspect_ids"))} this.save(mungedAttrs) + + function mungeAspects (value){ + return [value] + } } }); diff --git a/public/javascripts/app/templates/aspects-dropdown.handlebars b/public/javascripts/app/templates/aspects-dropdown.handlebars index b1e6ae6d7..14ed9dff6 100644 --- a/public/javascripts/app/templates/aspects-dropdown.handlebars +++ b/public/javascripts/app/templates/aspects-dropdown.handlebars @@ -1,25 +1,18 @@ -
+ +
All Aspects -
\ No newline at end of file +
+ + + + + + + + \ No newline at end of file diff --git a/public/javascripts/app/templates/post-form.handlebars b/public/javascripts/app/templates/post-form.handlebars index f57dd6c1b..7e7cdc321 100644 --- a/public/javascripts/app/templates/post-form.handlebars +++ b/public/javascripts/app/templates/post-form.handlebars @@ -2,10 +2,10 @@