posts_steps.rb 1.93 KB
Newer Older
1 2
Then /^the post "([^"]*)" should be marked nsfw$/ do |text|
  assert_nsfw(text)
3
end
4

5
Then /^the post should be collapsed$/ do
6
  first_post_collapsed?
7 8 9
end

Then /^the post should be expanded$/ do
10
  first_post_expanded?
11 12
end

13 14
Then /^I should see an uploaded image within the photo drop zone$/ do
  find("#photodropzone img")["src"].should include("uploads/images")
15
end
Maxwell Salzberg's avatar
Maxwell Salzberg committed
16

17
Then /^I should not see an uploaded image within the photo drop zone$/ do
18
  all("#photodropzone img").should be_empty
19 20
end

21
Then /^I should not see any posts in my stream$/ do
22
  all(".stream_element").should be_empty
23 24
end

Maxwell Salzberg's avatar
Maxwell Salzberg committed
25 26 27 28
Given /^"([^"]*)" has a public post with text "([^"]*)"$/ do |email, text|
  user = User.find_by_email(email)
  user.post(:status_message, :text => text, :public => true, :to => user.aspects)
end
29 30 31 32 33 34

Given /^"([^"]*)" has a non public post with text "([^"]*)"$/ do |email, text|
  user = User.find_by_email(email)
  user.post(:status_message, :text => text, :public => false, :to => user.aspects)
end

35

36 37 38
When /^The user deletes their first post$/ do
  @me.posts.first.destroy
end
Dan Hansen's avatar
wip  
Dan Hansen committed
39

40
When /^I click on the first block button/ do
danielgrippi's avatar
danielgrippi committed
41 42
  find(".block_user").click
end
Maxwell Salzberg's avatar
Maxwell Salzberg committed
43

44
When /^I expand the post$/ do
45
  expand_first_post
46
end
Maxwell Salzberg's avatar
Maxwell Salzberg committed
47

Dennis Collinson's avatar
broken  
Dennis Collinson committed
48
Then /^I should see "([^"]*)" as the first post in my stream$/ do |text|
Maxwell Salzberg's avatar
Maxwell Salzberg committed
49 50 51
  first_post_text.should include(text)
end

Dennis Collinson's avatar
broken  
Dennis Collinson committed
52 53
When /^I post "([^"]*)"$/ do |text|
  click_and_post(text)
Maxwell Salzberg's avatar
Maxwell Salzberg committed
54 55
end

Dennis Collinson's avatar
broken  
Dennis Collinson committed
56 57
When /^I click the publisher and post "([^"]*)"$/ do |text|
  click_and_post(text)
58 59 60 61 62
end

When /^I post an extremely long status message$/ do
  click_and_post("I am a very interesting message " * 64)
end
Jonne Haß's avatar
Jonne Haß committed
63 64 65 66

When /^I open the show page of the "([^"]*)" post$/ do |post_text|
  visit post_path_by_content(post_text)
end
Asphyxia's avatar
Asphyxia committed
67 68 69 70 71 72 73 74 75 76

When /^I select "([^"]*)" on the aspect dropdown$/ do |text|
  page.execute_script(
    "$('#publisher .dropdown .dropdown_list')
      .find('li').each(function(i,el){
      var elem = $(el);
      if ('" + text + "' == $.trim(elem.text()) ) {
        elem.click();
      }});")
end