C0 code coverage information
Generated on Sun May 10 11:15:58 +0100 2009 with rcov 0.8.2.1
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 Given /I am not logged in/ do
2 @user = nil
3 visit home_path
4 click_button 'Log out' if response.body =~ /log out/i
5 end
6
7 def create_user_from_login(login, extra_attributes = {})
8 create_user({ :login => login,
9 :email => "#{login}@email.invalid",
10 :forename => "#{login}:forename",
11 :surname => "#{login}:surname",
12 :url => "#{login}.personal.invalid.com",
13 :company_name => "#{login}:companyname",
14 :company_url => "#{login}.company.invalid.com",
15 :bio => "#{login}:bio",
16 :freelancer_info => "#{login}:freelancer_info",
17 :company_info => "#{login}:company_info"
18 }.merge(extra_attributes)
19 )
20 end
21
22 def create_user(extra_attributes = {})
23 unless @user = User.find_by_email(extra_attributes[:email]||'user:email')
24 @user = User.create!({
25 :email => 'user:email',
26 :login => 'test',
27 :password => 'test',
28 :forename => 'user:firstname',
29 :surname => 'user:lastname',
30 :company_name => 'user:companyname',
31 :password_confirmation => 'test'}.merge(extra_attributes)
32 )
33 @user.activate
34 end
35 @user
36 end
37
38 def create_user_and_login(extra_attributes = {})
39 Given 'I am not logged in'
40 @user = create_user(extra_attributes)
41 visit home_path
42 fill_in(:login_email, :with => @user.email)
43 fill_in(:login_password, :with => 'test')
44 click_button 'Login'
45 response.body.should =~ /Hello/
46 end
47
48 Given /^someone who can create and edit pages$/ do
49 create_user_and_login :able_to_manage_pages => true
50 end
51
52 Given /^I am someone who can create articles$/ do
53 create_user_and_login :able_to_create_articles => true
54 end
55
56 Given /^I am someone who can edit articles$/ do
57 create_user_and_login :able_to_edit_any_articles => true
58 end
59
60 Given /^I am someone who can create events$/ do
61 create_user_and_login :able_to_create_events => true
62 end
63
64 Given /^I am someone who can edit events$/ do
65 create_user_and_login :able_to_edit_any_events => true
66 end
67
68 Given /^I am someone who can create mailing lists$/ do
69 create_user_and_login :able_to_create_and_edit_mailing_lists => true, :email => 'mailing_list:editor', :login => 'mailing_list:editor'
70 end
71
72 Given /^I am someone who can create mails$/ do
73 create_user_and_login :able_to_create_mails => true, :email => 'mail:creator', :login => 'mail:creator'
74 end
75
76 Given /I am someone who can edit comments/ do
77 create_user_and_login :able_to_edit_any_comments => true
78 end
79
80 Given /I am someone who can edit site preferences/ do
81 create_user_and_login :able_to_edit_preferences => true
82 end
83
84 Given /^a user with email "(.*?)" that hasn't activated$/ do |email|
85 @user = User.create!(:email => email, :login => email[/(.*?)@/,1],:password => 'test',:password_confirmation => 'test')
86 end
87
88 Given /^I am a user who is logged in$/ do
89 create_user_and_login
90 end
91
92 Given /^a user with email "(.*?)"$/ do |email|
93 @user = User.create!(:email => email, :login => email[/(.*?)@/,1],:password => 'test',:password_confirmation => 'test')
94 @user.activate
95 end
96
97 Then /^I should see an activation link in the email$/ do
98 Given "I should see \"activation_code=#{User.find_by_login('test').activation_code}\" in the email"
99 end
100
101
102 When /I visit the wrong activation url/ do
103 visit activate_login_url(:activation_code => @user.activation_code + "x" )
104 end
105
106 When /I visit the right activation url/ do
107 visit activate_login_url(:activation_code => @user.activation_code)
108 end
109
110 When /I enter the password from the email/ do
111 When "I fill in \"login_password\" with \"#{current_email.body[/Password: ([^\n]*)/m,1]}\""
112 end
113
114 Given /^a user called "(.*?)" who likes to keep their information private$/ do |login|
115 create_user_from_login(login, :privacy => 1)
116 end
117
118 Given /^a user called "(.*?)" who is willing to share their real name, urls and biographic details$/ do |login|
119 create_user_from_login(login, :privacy => 2)
120 end
121
122 Given /^a user called "(.*?)" who is happy to publish everything, including their email$/ do |login|
123 create_user_from_login(login, :privacy => 3)
124 end
125
126 When /^I visit the list of users$/ do
127 visit users_url
128 end
129
130 When /^I visit user "(.*?)"'s page$/ do |login|
131 visit user_url(User.find_by_login(login))
132 end
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.2.1.