add the publisher back to ones own profile, fix some cukes

This commit is contained in:
Florian Staudacher 2014-09-16 02:16:14 +02:00
parent a5da2ca48c
commit 300496090b
8 changed files with 36 additions and 19 deletions

View file

@ -80,6 +80,11 @@ app.pages.Profile = app.views.Base.extend({
collection: this.streamCollection
});
app.stream.fetch();
if( this.model.get('is_own_profile') ) {
app.publisher = new app.views.Publisher({collection : app.stream.items});
}
return new view({model: app.stream});
},

View file

@ -21,10 +21,14 @@
.stream_container
-if user_signed_in? && current_page?(person_path(current_user.person))
= render 'publisher/publisher', publisher_aspects_for(nil)
#main_stream.stream
-# JS
#paginate
%span.loader.hidden
%a{:id=>"back-to-top", :title=>"#{t('layouts.application.back_to_top')}", :href=>"#"}
⇧

View file

@ -18,9 +18,7 @@ Feature: Blocking a user from the stream
Then I should not see any posts in my stream
Scenario: Blocking a user from the profile page
When I am on the home page
And I follow "Alice Smith"
When I am on "alice@alice.alice"'s page
When I click on the profile block button
And I confirm the alert
And I am on the home page
Then I should not see any posts in my stream

View file

@ -42,7 +42,7 @@ Feature: preview posts in the stream
Scenario: preview a photo with text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
When I fill in the following:
| status_message_fake_text | Look at this dog |
And I press "Preview"

View file

@ -69,7 +69,7 @@ Feature: posting from the main page
Scenario: post a photo with text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
When I write the status message "Look at this dog"
And I submit the publisher
And I go to the aspects page
@ -83,7 +83,7 @@ Feature: posting from the main page
Scenario: post a photo without text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
Then I should see an uploaded image within the photo drop zone
When I press "Share"
And I go to the aspects page
@ -96,10 +96,10 @@ Feature: posting from the main page
Scenario: back out of posting a photo-only post
Given I expand the publisher
And I have turned off jQuery effects
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
And I confirm the alert
Then I should not see an uploaded image within the photo drop zone
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
And I click to delete the first uploaded photo
Then I should not see an uploaded image within the photo drop zone
And I should not be able to submit the publisher
@ -108,7 +108,7 @@ Feature: posting from the main page
Given I expand the publisher
And I have turned off jQuery effects
When I write the status message "I am eating a yogurt"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
And I click to delete the first uploaded photo
Then I should not see an uploaded image within the photo drop zone
And the publisher should be expanded
@ -117,8 +117,8 @@ Feature: posting from the main page
Given I expand the publisher
And I have turned off jQuery effects
When I write the status message "I am eating a yogurt"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
And I attach "spec/fixtures/button.png" to the publisher
And I click to delete the first uploaded photo
Then I should see an uploaded image within the photo drop zone
And the publisher should be expanded

View file

@ -34,11 +34,9 @@ Feature: posting from own profile page
Scenario: post a photo with text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
When I fill in the following:
| status_message_fake_text | who am I? |
And I press "Share"
When I write the status message "who am I?"
And I attach "spec/fixtures/button.png" to the publisher
And I submit the publisher
When I am on the home page
Then I should see a "img" within ".stream_element div.photo_attachments"
@ -47,6 +45,6 @@ Feature: posting from own profile page
Scenario: back out of posting a photo-only post
Given I expand the publisher
And I have turned off jQuery effects
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach "spec/fixtures/button.png" to the publisher
And I click to delete the first uploaded photo
Then I should not see an uploaded image within the photo drop zone

View file

@ -15,7 +15,7 @@ Then /^I should not see an uploaded image within the photo drop zone$/ do
end
Then /^I should not see any posts in my stream$/ do
all(".stream_element").should be_empty
page.assert_selector(".stream_element", count: 0)
end
Then /^I should not be able to submit the publisher$/ do
@ -83,6 +83,10 @@ When /^I append "([^"]*)" to the mobile publisher$/ do |text|
append_to_publisher(text, '#status_message_text')
end
When /^I attach "([^"]*)" to the publisher$/ do |path|
upload_file_with_publisher(path)
end
When /^I open the show page of the "([^"]*)" post$/ do |post_text|
visit post_path_by_content(post_text)
end

View file

@ -4,13 +4,21 @@ module PublishingCukeHelpers
end
def append_to_publisher(txt, input_selector='#status_message_fake_text')
elem = find(input_selector)
elem = find(input_selector, visible: false)
elem.native.send_keys(' ' + txt)
# make sure the other text field got the new contents
expect(find('#status_message_text', visible: false).value).to include(txt)
end
def upload_file_with_publisher(path)
page.execute_script(%q{$("input[name='file']").css("opacity", '1');})
with_scope("#publisher_textarea_wrapper") do
attach_file("file", Rails.root.join(path).to_s)
page.assert_selector(".publisher_photo.loading", count: 0)
end
end
def make_post(text)
write_in_publisher(text)
submit_publisher