diff --git a/_includes/head.html b/_includes/head.html index 2fa66a6e0..5d69a3402 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -1,5 +1,5 @@ - +
{% include meta.html %} diff --git a/_includes/meta.html b/_includes/meta.html index b63d01385..27143d059 100644 --- a/_includes/meta.html +++ b/_includes/meta.html @@ -89,3 +89,6 @@ + +{%comment%}{%endcomment%} + diff --git a/rails-models.md b/rails-models.md index 870311ecd..793f26980 100644 --- a/rails-models.md +++ b/rails-models.md @@ -139,8 +139,8 @@ Validation validates :name, length: { minimum: 2 } validates :bio, length: { maximum: 500 } - validates :password, length: { in => 6..20 } - validates :number, length: { is => 6 } + validates :password, length: { in: => 6..20 } + validates :number, length: { is: => 6 } validates :gender, inclusion: %w(male female) validates :gender, inclusion: { in: %w(male female) } @@ -148,6 +148,9 @@ Validation validates :points, numericality: true validates :played, numericality: { only_integer: true } + # ... greater_than, greater_than_or_equal_to, + # ... less_than, less_than_or_equal_to + # ... odd, even, equal_to # Validate the associated records to ensure they're valid as well has_many :books diff --git a/rspec.md b/rspec.md index 6534b3778..8b126c8e6 100644 --- a/rspec.md +++ b/rspec.md @@ -51,60 +51,63 @@ layout: default it "should do this" do pending "some other thing" - subject.name = 'x' - subject.name.should == 'x' + expect(subject.name).to eq 'x' end end end ### Expectations - # Can be: - # target.should - # target.should_not - # expect(target).to +```rb +target.should eq 1 +target.should_not eq 1 +expect(target).to eq 1 +expect(target).not_to eq 1 +``` - # Numeric - be < 6 - == 5 - equal value - be_between(1, 10) - be_close value, tolerance +```rb +# Numeric +be < 6 +== 5 +equal value +be_between(1, 10) +be_close value, tolerance - be value - satisfy {|arg| ...} - predicate [optional args] - match regexp +be value +satisfy {|arg| ...} +predicate [optional args] +match regexp - be_an_instance_of