posts_steps.rb 2.18 KB
Newer Older
1
Then /^the post should be collapsed$/ do
2
  first_post_collapsed?
3 4 5
end

Then /^the post should be expanded$/ do
6
  first_post_expanded?
7 8
end

9
Then /^I should see an uploaded image within the photo drop zone$/ do
Jonne Haß's avatar
Jonne Haß committed
10
  find("#photodropzone img", visible: false)["src"].should include("uploads/images")
11
end
Maxwell Salzberg's avatar
Maxwell Salzberg committed
12

13
Then /^I should not see an uploaded image within the photo drop zone$/ do
Jonne Haß's avatar
Jonne Haß committed
14
  page.should_not have_css "#photodropzone img"
15 16
end

17
Then /^I should not see any posts in my stream$/ do
18
  all(".stream_element").should be_empty
19 20
end

Maxwell Salzberg's avatar
Maxwell Salzberg committed
21 22 23 24
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
25 26 27 28 29 30

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

31 32 33 34 35
And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email|
  user = User.find_by_email(email)
  root = Post.find_by_text(text)
  user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspects)
end
36

37
When /^I click on the first block button/ do
Jonne Haß's avatar
Jonne Haß committed
38
  find(".block_user", visible: false).click
danielgrippi's avatar
danielgrippi committed
39
end
Maxwell Salzberg's avatar
Maxwell Salzberg committed
40

41
When /^I expand the post$/ do
42
  expand_first_post
43
end
Maxwell Salzberg's avatar
Maxwell Salzberg committed
44

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

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

Dennis Collinson's avatar
broken  
Dennis Collinson committed
53 54
When /^I click the publisher and post "([^"]*)"$/ do |text|
  click_and_post(text)
55 56 57 58 59
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
60

61 62 63 64
When /^I insert an extremely long status message$/ do
  fill_in 'status_message_fake_text', :with => "I am a very interesting message " * 64
end

Jonne Haß's avatar
Jonne Haß committed
65 66 67
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
68 69 70 71 72 73 74 75 76 77

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