Commit b67f8a16d1537a795a1b44ff5d557b500a565924

Authored by Rafael Martins
1 parent fe0e15b4

Moved a functional test case from MembershipsController to a feature

features/create_community.feature
... ... @@ -17,6 +17,7 @@ Feature: create community
17 17 And I fill in "Name" with "Fancy community"
18 18 And I press "Create"
19 19 Then I should see "Fancy community"
  20 + And I should see "Fancy community"'s creation date
20 21  
21 22 Scenario: a user creates a community when environment moderates it
22 23 Given I am logged in as "joaosilva"
... ...
features/step_definitions/create_community_steps.rb
  1 +include DatesHelper
  2 +
1 3 Given /^I create community "(.+)"$/ do |community|
2 4 Given 'I go to the Control panel'
3 5 click_link('Manage my groups')
... ... @@ -21,3 +23,10 @@ Given /^I reject community "(.+)"$/ do |community|
21 23 choose("decision-cancel-#{task.id}")
22 24 click_button('Apply!')
23 25 end
  26 +
  27 +Then /^I should see "([^\"]*)"'s creation date$/ do |community|
  28 + com = Community.find_by_name community
  29 + text = "Created at: #{show_date(com.created_at)}"
  30 + response.should contain(text)
  31 +end
  32 +
... ...
test/functional/memberships_controller_test.rb
... ... @@ -73,13 +73,6 @@ class MembershipsControllerTest < ActionController::TestCase
73 73 assert_tag :tag => 'li', :content => /Members: 1/
74 74 end
75 75  
76   - should 'show created at on list' do
77   - community = Community.create!(:name => 'my test community')
78   - community.add_member(profile)
79   - get :index, :profile => profile.identifier
80   - assert_tag :tag => 'li', :content => /Created at: #{show_date(community.created_at)}/
81   - end
82   -
83 76 should 'show description on list' do
84 77 community = Community.create!(:name => 'my test community', :description => 'description test')
85 78 community.add_member(profile)
... ...