wtforum 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ module WTForum
10
10
  defaults = { pw: SecureRandom.hex(10) }
11
11
  attributes[:member] ||= attributes.delete(:username)
12
12
  attributes[:field276177] ||= attributes.delete(:gender)
13
+ attributes[:field276178] ||= attributes.delete(:location)
13
14
  attributes[:field276179] ||= attributes.delete(:about)
14
15
  attributes.reverse_merge! defaults
15
16
  uri = create_uri attributes
@@ -29,8 +30,10 @@ module WTForum
29
30
  id: user_id,
30
31
  member: body.css(".tables td:contains('Username:') + td input").first["value"],
31
32
  email: body.css(".tables td:contains('Email Address:') + td").first.text.split(" - ").first,
32
- field276177: body.css(".tables td:contains('Gender:') + td option[selected]").first.try(:text),
33
- field276179: body.css(".tables td:contains('About Me:') + td textarea").first.text
33
+ name: body.css(".tables td:contains('Full Name:') + td input").first["value"],
34
+ field276177: body.css(".tables select[name='field276177'] option[selected]").first.try(:text),
35
+ field276178: body.css(".tables input[name='field276178']").first["value"],
36
+ field276179: body.css(".tables textarea[name='field276179']").first.text
34
37
  }
35
38
  new(attributes)
36
39
  end
@@ -79,7 +82,9 @@ module WTForum
79
82
  def save!
80
83
  self.class.authorized_agent.get(self.class.edit_uri(id)) do |page|
81
84
  form = page.forms.first
85
+ form["name"] = name
82
86
  form["field276177"] = field276177
87
+ form["field276178"] = field276178
83
88
  form["field276179"] = field276179
84
89
  form.submit
85
90
  end
@@ -99,7 +104,7 @@ module WTForum
99
104
  self.class.destroy id
100
105
  end
101
106
 
102
- attr_accessor :id, :member, :email, :field276177, :field276179
107
+ attr_accessor :id, :member, :email, :name, :field276177, :field276178, :field276179
103
108
  attr_writer :pw, :apikey
104
109
 
105
110
  def username
@@ -118,6 +123,14 @@ module WTForum
118
123
  self.field276177 = value
119
124
  end
120
125
 
126
+ def location
127
+ field276178
128
+ end
129
+
130
+ def location= value
131
+ self.field276178 = value
132
+ end
133
+
121
134
  def about
122
135
  field276179
123
136
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module WTForum
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -8,21 +8,37 @@ describe WTForum::User do
8
8
  user = nil
9
9
 
10
10
  lambda {
11
- user = WTForum::User.create username: "wtforum_test_user", email: "wtforum_test_user@example.com", gender: "Male", about: "I am a test user"
11
+ user = WTForum::User.create(
12
+ username: "wtforum_test_user",
13
+ email: "wtforum_test_user@example.com",
14
+ name: "Test User",
15
+ gender: "Male",
16
+ location: "Portland, Oregon, USA",
17
+ about: "I am a test user")
12
18
  }.should change(WTForum::User, :count).by(1)
13
19
 
14
20
  user = WTForum::User.find(user.id)
15
21
  user.username.should == "wtforum_test_user"
16
22
  user.email.should == "wtforum_test_user@example.com"
23
+ user.name.should == "Test User"
17
24
  user.gender.should == "Male"
25
+ user.location.should == "Portland, Oregon, USA"
18
26
  user.about.should == "I am a test user"
19
27
 
20
- user.update_attributes! username: "wtforum_test_user_2", email: "wtforum_test_user_2@example.com", gender: "Female", about: "I am an updated test user"
28
+ user.update_attributes!(
29
+ username: "wtforum_test_user_2",
30
+ email: "wtforum_test_user_2@example.com",
31
+ name: "Test User 2",
32
+ gender: "Female",
33
+ location: "Vancouver, BC, Canada",
34
+ about: "I am an updated test user")
21
35
 
22
36
  user = WTForum::User.find_by_username("wtforum_test_user_2")
23
37
  user.username.should == "wtforum_test_user_2"
24
38
  user.email.should == "wtforum_test_user_2@example.com"
39
+ user.name.should == "Test User 2"
25
40
  user.gender.should == "Female"
41
+ user.location.should == "Vancouver, BC, Canada"
26
42
  user.about.should == "I am an updated test user"
27
43
 
28
44
  ensure
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wtforum
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Micah Geisel
@@ -155,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - ! '>='
157
157
  - !ruby/object:Gem::Version
158
- hash: 1492844664817071908
158
+ hash: 2553523056140259474
159
159
  segments:
160
160
  - 0
161
161
  version: '0'
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - - ! '>='
166
166
  - !ruby/object:Gem::Version
167
- hash: 1492844664817071908
167
+ hash: 2553523056140259474
168
168
  segments:
169
169
  - 0
170
170
  version: '0'