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"
Scenario: posting a message appends it to the top of the stream
Given I have a prexisting post
And I post "hey there"
When I click the publisher and post "sup dog"
And I click the publisher and post "hello there"
Then I should see "hello there" as the first post in my stream
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
When /^I wait for the ajax to finish$/ do
wait_until(15) { evaluate_script("$.active") == 0 }
wait_for_ajax_to_finish
end
When /^I have turned off jQuery effects$/ do

View file

@ -32,10 +32,6 @@ end
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|
create_from_table(model_name, {}, 'user' => @me)
end

View file

@ -36,13 +36,14 @@ When /^I click on the first block button/ do
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)
end
Given /^"I post "([^"]*)"$/ do |text|
make_post(text)
When /^I post "([^"]*)"$/ do |text|
click_and_post(text)
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,14 +1,19 @@
module PublishingCukeHelpers
def make_post(text)
click_publisher
fill_in 'status_message_fake_text', :with => text
click_button :submit
wait_for_ajax_to_finish
end
def click_and_post(text)
click_publisher
make_post(text)
end
def click_publisher
page.execute_script('
$("#publisher").removeClass("closed");
$("#publisher").find("textarea").focus();
$("#publisher").removeClass("closed");
$("#publisher").find("textarea").focus();
')
end
@ -20,6 +25,10 @@ module PublishingCukeHelpers
find(".stream_element:contains('#{text}')")
end
def wait_for_ajax_to_finish(wait_time=15)
wait_until(wait_time) { evaluate_script("$.active") == 0 }
end
def assert_nsfw(text)
post = find_post_by_text(text)
post.find(".shield").should be_present

View file

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