saucy 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.5.5
2
+
3
+ Fixes for account and project keywords containing special characters, generated by signup
4
+
1
5
  0.5.4
2
6
 
3
7
  Changes from an archive project link to a checkbox on the project form.
data/app/models/signup.rb CHANGED
@@ -98,9 +98,9 @@ class Signup
98
98
 
99
99
  def short_name
100
100
  if email.present?
101
- email.split(/@/).first
101
+ email.split(/@/).first.parameterize
102
102
  elsif user && user.email.present?
103
- existing_user.email.split(/@/).first
103
+ existing_user.email.split(/@/).first.parameterize
104
104
  end
105
105
  end
106
106
 
data/lib/saucy/account.rb CHANGED
@@ -25,7 +25,7 @@ module Saucy
25
25
  attr_accessible :name, :keyword
26
26
 
27
27
  validates_format_of :keyword,
28
- :with => %r{^[a-z0-9_]+$},
28
+ :with => %r{^[a-z0-9_-]+$},
29
29
  :message => "must be only lower case letters and underscores."
30
30
 
31
31
  before_create :set_trial_expiration
data/lib/saucy/project.rb CHANGED
@@ -12,7 +12,7 @@ module Saucy
12
12
  validates_uniqueness_of :keyword, :scope => :account_id
13
13
 
14
14
  validates_format_of :keyword,
15
- :with => %r{^[a-z0-9_]+$},
15
+ :with => %r{^[a-z0-9_-]+$},
16
16
  :message => "must be only lower case letters or underscores."
17
17
 
18
18
 
@@ -16,6 +16,7 @@ describe Account do
16
16
  it { should allow_value("hello").for(:keyword) }
17
17
  it { should allow_value("0123").for(:keyword) }
18
18
  it { should allow_value("hello_world").for(:keyword) }
19
+ it { should allow_value("hello-world").for(:keyword) }
19
20
  it { should_not allow_value("HELLO").for(:keyword) }
20
21
  it { should_not allow_value("hello world").for(:keyword) }
21
22
 
@@ -10,6 +10,7 @@ describe Project do
10
10
  it { should allow_value("hello").for(:keyword) }
11
11
  it { should allow_value("0123").for(:keyword) }
12
12
  it { should allow_value("hello_world").for(:keyword) }
13
+ it { should allow_value("hello-world").for(:keyword) }
13
14
  it { should_not allow_value("HELLO").for(:keyword) }
14
15
  it { should_not allow_value("hello world").for(:keyword) }
15
16
 
@@ -91,6 +91,22 @@ describe Signup, "with a valid user and account" do
91
91
  end
92
92
  end
93
93
 
94
+ describe Signup, "with an email with symbols in it" do
95
+ subject { Factory.build(:signup, :email => "user+extra@example.com") }
96
+
97
+ before do
98
+ subject.save
99
+ end
100
+
101
+ it "gives a friendly account name" do
102
+ subject.account.name.should == "user-extra"
103
+ end
104
+
105
+ it "gives a friendly account keyword" do
106
+ subject.account.keyword.should =~ /^user-extra+/
107
+ end
108
+ end
109
+
94
110
  describe Signup, "with an invalid user" do
95
111
  subject { Factory.build(:signup, :email => nil) }
96
112
  it_should_behave_like "invalid signup"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 4
10
- version: 0.5.4
9
+ - 5
10
+ version: 0.5.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc.