wtforum 0.5.0 → 0.6.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.
@@ -55,5 +55,56 @@ describe WTForum::User, vcr: true do
55
55
  wtforum.find_user(0)
56
56
  }.should raise_exception(WTForum::User::NotFound)
57
57
  end
58
+
59
+ it "raises an exception when a username is already taken and the retry option is false" do
60
+ begin
61
+ wtforum.create_user(
62
+ username: "wtforum_test_user",
63
+ email: "wtforum_test_user@example.com",
64
+ name: "Test User",
65
+ gender: "Male",
66
+ location: "Portland, Oregon, USA",
67
+ about: "I am a test user")
68
+ lambda {
69
+ wtforum.create_user(
70
+ username: "wtforum_test_user",
71
+ email: "some_other_wtforum_test_user@example.com",
72
+ name: "Some Other Test User",
73
+ gender: "Male",
74
+ location: "Portland, Oregon, USA",
75
+ about: "I am another test user",
76
+ retry: false)
77
+ }.should raise_exception(WTForum::User::UsernameAlreadyTaken)
78
+
79
+ ensure
80
+ wtforum.find_user_by_username("wtforum_test_user").destroy rescue nil
81
+ end
82
+ end
83
+
84
+ it "retries with successive usernames if one is already taken" do
85
+ begin
86
+ wtforum.create_user(
87
+ username: "wtforum_test_user",
88
+ email: "wtforum_test_user@example.com",
89
+ name: "Test User",
90
+ gender: "Male",
91
+ location: "Portland, Oregon, USA",
92
+ about: "I am a test user")
93
+
94
+ wtforum_user = wtforum.create_user(
95
+ username: "wtforum_test_user",
96
+ email: "some_other_wtforum_test_user@example.com",
97
+ name: "Some Other Test User",
98
+ gender: "Male",
99
+ location: "Portland, Oregon, USA",
100
+ about: "I am another test user")
101
+
102
+ wtforum_user.username.should == "wtforum_test_user1"
103
+
104
+ ensure
105
+ wtforum.find_user_by_username("wtforum_test_user").destroy rescue nil
106
+ wtforum.find_user_by_username("wtforum_test_user1").destroy rescue nil
107
+ end
108
+ end
58
109
  end
59
110
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wtforum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-04 00:00:00.000000000 Z
11
+ date: 2013-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -158,6 +158,8 @@ files:
158
158
  - spec/fixtures/vcr_cassettes/WTForum_Session/when_user_exists/can_log_in_users.yml
159
159
  - spec/fixtures/vcr_cassettes/WTForum_User/can_CRUD_users.yml
160
160
  - spec/fixtures/vcr_cassettes/WTForum_User/raises_an_exception_when_a_user_is_not_found.yml
161
+ - spec/fixtures/vcr_cassettes/WTForum_User/raises_an_exception_when_a_username_is_already_taken_and_the_retry_option_is_false.yml
162
+ - spec/fixtures/vcr_cassettes/WTForum_User/retries_with_successive_usernames_if_one_is_already_taken.yml
161
163
  - spec/integration/wtforum_session_spec.rb
162
164
  - spec/integration/wtforum_spec.rb
163
165
  - spec/integration/wtforum_user_spec.rb
@@ -192,6 +194,8 @@ test_files:
192
194
  - spec/fixtures/vcr_cassettes/WTForum_Session/when_user_exists/can_log_in_users.yml
193
195
  - spec/fixtures/vcr_cassettes/WTForum_User/can_CRUD_users.yml
194
196
  - spec/fixtures/vcr_cassettes/WTForum_User/raises_an_exception_when_a_user_is_not_found.yml
197
+ - spec/fixtures/vcr_cassettes/WTForum_User/raises_an_exception_when_a_username_is_already_taken_and_the_retry_option_is_false.yml
198
+ - spec/fixtures/vcr_cassettes/WTForum_User/retries_with_successive_usernames_if_one_is_already_taken.yml
195
199
  - spec/integration/wtforum_session_spec.rb
196
200
  - spec/integration/wtforum_spec.rb
197
201
  - spec/integration/wtforum_user_spec.rb