ref: master
features/step_definitions/create_community_steps.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
include DatesHelper Given /^I create community "(.+)"$/ do |community| step %{I go to admin_user's control panel} click_link('Manage my groups') click_link('Create a new community') fill_in("Name", :with => community) click_button("Create") end Given /^"(.+)" creates the community "(.+)"$/ do |username, community| step %{I go to #{username}'s control panel} click_link('Manage my groups') click_link('Create a new community') fill_in("Name", :with => community) click_button("Create") end Given /^I approve community "(.+)"$/ do |community| task = CreateCommunity.all.select {|c| c.name == community}.first step %{I go to admin_user's control panel} click_link('Process requests') choose("decision-finish-#{task.id}") first(:button, 'Apply!').click end Given /^I reject community "(.+)"$/ do |community| task = CreateCommunity.all.select {|c| c.name == community}.first step %{I go to admin_user's control panel} click_link('Process requests') choose("decision-cancel-#{task.id}") first(:button, 'Apply!').click end Then /^I should see "([^\"]*)"'s creation date$/ do |community| com = Community.find_by name: community text = "Created at: #{show_date(com.created_at)}" has_content?(text) end |