saucy 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/saucy/account.rb CHANGED
@@ -25,8 +25,8 @@ module Saucy
25
25
  attr_accessible :name, :keyword
26
26
 
27
27
  validates_format_of :keyword,
28
- :with => %r{^[a-z0-9]+$},
29
- :message => "must be only lower case letters."
28
+ :with => %r{^[a-z0-9_]+$},
29
+ :message => "must be only lower case letters and underscores."
30
30
 
31
31
  before_create :set_trial_expiration
32
32
  end
data/lib/saucy/project.rb CHANGED
@@ -12,8 +12,8 @@ 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]+$},
16
- :message => "must be only lower case letters."
15
+ :with => %r{^[a-z0-9_]+$},
16
+ :message => "must be only lower case letters or underscores."
17
17
 
18
18
 
19
19
  after_create :setup_memberships
@@ -14,6 +14,12 @@ describe Account do
14
14
  it { should validate_presence_of(:keyword) }
15
15
  it { should validate_presence_of(:plan_id) }
16
16
 
17
+ it { should allow_value("hello").for(:keyword) }
18
+ it { should allow_value("0123").for(:keyword) }
19
+ it { should allow_value("hello_world").for(:keyword) }
20
+ it { should_not allow_value("HELLO").for(:keyword) }
21
+ it { should_not allow_value("hello world").for(:keyword) }
22
+
17
23
  it { should_not allow_mass_assignment_of(:id) }
18
24
  it { should_not allow_mass_assignment_of(:updated_at) }
19
25
  it { should_not allow_mass_assignment_of(:created_at) }
@@ -7,6 +7,12 @@ describe Project do
7
7
  it { should validate_presence_of(:keyword) }
8
8
  it { should validate_presence_of(:name) }
9
9
 
10
+ it { should allow_value("hello").for(:keyword) }
11
+ it { should allow_value("0123").for(:keyword) }
12
+ it { should allow_value("hello_world").for(:keyword) }
13
+ it { should_not allow_value("HELLO").for(:keyword) }
14
+ it { should_not allow_value("hello world").for(:keyword) }
15
+
10
16
  it "finds projects visible to a user" do
11
17
  account = Factory(:account)
12
18
  user = Factory(:user)
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc.