Commit 9b39bfdc5bb9c351595d9b9dda3a29505876efbb
1 parent
892da9b5
Exists in
master
and in
29 other branches
Tests for Gravatar Support
Adds gravatar_support.feature (selenium tests) and new path for cucumber
Showing
3 changed files
with
39 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +Feature: Gravatar Support | ||
2 | + Unauthenticated users may comment content and are displayed with Gravatar | ||
3 | + pictures. The commenter with registered Gravatar image will have a link to | ||
4 | + his/her Gravatar profile, others will have a link to the Gravatar homepage. | ||
5 | + | ||
6 | + Background: | ||
7 | + Given the following users | ||
8 | + | login | name | | ||
9 | + | manuel | Manuel Silva | | ||
10 | + And the following articles | ||
11 | + | owner | name | | ||
12 | + | manuel | My Article | | ||
13 | + And the following comments | ||
14 | + | article | author | name | email | title | body | | ||
15 | + | My Article | manuel | | | 1 | Hi! | | ||
16 | + | My Article | | Aurium | aurium@gmail.com | 2 | Hello! | | ||
17 | + | My Article | | NoOne | nobody@colivre.coop.br | 3 | Bye! | | ||
18 | + | ||
19 | + @selenium | ||
20 | + Scenario: The Aurium's gravatar picture must link to his gravatar profile | ||
21 | + # because Aurium has his picture registered at garvatar.com. | ||
22 | + When I go to article "My Article" | ||
23 | + Then I should see "Aurium" linking to "http://www.gravatar.com/24a625896a07aa37fdb2352e302e96de" | ||
24 | + | ||
25 | + @selenium | ||
26 | + Scenario: The NoOne's gravatar picture must link to Gravatar homepage | ||
27 | + # because NoOne <nobody@colivre.coop.br> has no picture registered. | ||
28 | + When I go to article "My Article" | ||
29 | + Then I should see "NoOne" linking to "http://www.gravatar.com" | ||
30 | + |
features/support/paths.rb
@@ -14,6 +14,9 @@ module NavigationHelpers | @@ -14,6 +14,9 @@ module NavigationHelpers | ||
14 | when /^\// | 14 | when /^\// |
15 | page_name | 15 | page_name |
16 | 16 | ||
17 | + when /article "([^"]+)"\s*$/ | ||
18 | + url_for( Article.find_by_name($1).url ) | ||
19 | + | ||
17 | when /edit "(.+)" by (.+)/ | 20 | when /edit "(.+)" by (.+)/ |
18 | article_id = Person[$2].articles.find_by_slug($1.to_slug).id | 21 | article_id = Person[$2].articles.find_by_slug($1.to_slug).id |
19 | "/myprofile/#{$2}/cms/edit/#{article_id}" | 22 | "/myprofile/#{$2}/cms/edit/#{article_id}" |
test/unit/application_helper_test.rb
@@ -467,7 +467,7 @@ class ApplicationHelperTest < Test::Unit::TestCase | @@ -467,7 +467,7 @@ class ApplicationHelperTest < Test::Unit::TestCase | ||
467 | assert_match(/Community nick/, page_title) | 467 | assert_match(/Community nick/, page_title) |
468 | end | 468 | end |
469 | 469 | ||
470 | - should 'generate a gravatar url' do | 470 | + should 'generate a gravatar image url' do |
471 | with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do | 471 | with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do |
472 | url = str_gravatar_url_for( 'rms@gnu.org', :size => 50 ) | 472 | url = str_gravatar_url_for( 'rms@gnu.org', :size => 50 ) |
473 | assert_match(/^http:\/\/www\.gravatar\.com\/avatar\.php\?/, url) | 473 | assert_match(/^http:\/\/www\.gravatar\.com\/avatar\.php\?/, url) |
@@ -477,6 +477,11 @@ class ApplicationHelperTest < Test::Unit::TestCase | @@ -477,6 +477,11 @@ class ApplicationHelperTest < Test::Unit::TestCase | ||
477 | end | 477 | end |
478 | end | 478 | end |
479 | 479 | ||
480 | + should 'generate a gravatar profile url' do | ||
481 | + url = gravatar_profile_url( 'rms@gnu.org' ) | ||
482 | + assert_equal('http://www.gravatar.com/ed5214d4b49154ba0dc397a28ee90eb7', url) | ||
483 | + end | ||
484 | + | ||
480 | should 'use theme passed via param when in development mode' do | 485 | should 'use theme passed via param when in development mode' do |
481 | stubs(:environment).returns(Environment.new(:theme => 'environment-theme')) | 486 | stubs(:environment).returns(Environment.new(:theme => 'environment-theme')) |
482 | ENV.stubs(:[]).with('RAILS_ENV').returns('development') | 487 | ENV.stubs(:[]).with('RAILS_ENV').returns('development') |