This commit is contained in:
Dennis Collinson 2012-02-06 14:55:14 -08:00
parent 4382d45e82
commit 578e8ef269
7 changed files with 29 additions and 15 deletions

View file

@ -25,8 +25,8 @@ Feature: posting from the main page
Then I should see "I am eating a yogurt" within ".stream_element" Then I should see "I am eating a yogurt" within ".stream_element"
Scenario: posting a message appends it to the top of the stream Scenario: posting a message appends it to the top of the stream
Given I have a prexisting post When I click the publisher and post "sup dog"
And I post "hey there" And I click the publisher and post "hello there"
Then I should see "hello there" as the first post in my stream Then I should see "hello there" as the first post in my stream
Scenario: post a text-only message to just one aspect Scenario: post a text-only message to just one aspect

View file

@ -103,7 +103,7 @@ Then /^(?:|I )should not see a "([^\"]*)"(?: within "([^\"]*)")?$/ do |selector,
end end
When /^I wait for the ajax to finish$/ do When /^I wait for the ajax to finish$/ do
wait_until(15) { evaluate_script("$.active") == 0 } wait_for_ajax_to_finish
end end
When /^I have turned off jQuery effects$/ do When /^I have turned off jQuery effects$/ do

View file

@ -32,10 +32,6 @@ end
World(FactoryMethods) World(FactoryMethods)
Given /I have a prexisting post/ do
Factory(:status_message, :author => @me.person, :public => true)
end
Given %r{^I have a (.+)$} do |model_name| Given %r{^I have a (.+)$} do |model_name|
create_from_table(model_name, {}, 'user' => @me) create_from_table(model_name, {}, 'user' => @me)
end end

View file

@ -36,13 +36,14 @@ When /^I click on the first block button/ do
end end
Then /^I should see "([^"]*)" as the first post in my stream$/ do |text|
Then /^"I should see "([^"]*)" as the first post in my stream$/ do |text|
first_post_text.should include(text) first_post_text.should include(text)
end end
Given /^"I post "([^"]*)"$/ do |text| When /^I post "([^"]*)"$/ do |text|
make_post(text) click_and_post(text)
end end
When /^I click the publisher and post "([^"]*)"$/ do |text|
click_and_post(text)
end

View file

@ -0,0 +1,3 @@
Then /^I should see an image in the publisher$/ do
photo_in_publisher.should be_present
end

View file

@ -1,8 +1,13 @@
module PublishingCukeHelpers module PublishingCukeHelpers
def make_post(text) def make_post(text)
click_publisher
fill_in 'status_message_fake_text', :with => text fill_in 'status_message_fake_text', :with => text
click_button :submit click_button :submit
wait_for_ajax_to_finish
end
def click_and_post(text)
click_publisher
make_post(text)
end end
def click_publisher def click_publisher
@ -20,6 +25,10 @@ module PublishingCukeHelpers
find(".stream_element:contains('#{text}')") find(".stream_element:contains('#{text}')")
end end
def wait_for_ajax_to_finish(wait_time=15)
wait_until(wait_time) { evaluate_script("$.active") == 0 }
end
def assert_nsfw(text) def assert_nsfw(text)
post = find_post_by_text(text) post = find_post_by_text(text)
post.find(".shield").should be_present post.find(".shield").should be_present

View file

@ -9,4 +9,9 @@ app.collections.Posts = Backbone.Collection.extend({
parse: function(resp){ parse: function(resp){
return resp.posts; return resp.posts;
} }
//
//
// comparator : function(post) {
// return -post.createdAt();
// }
}); });