forked from ginty/cranky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
source "http://gemcutter.org" | ||
|
||
group :development do | ||
gem "activemodel" | ||
gem "rake" | ||
gem "gemcutter" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,18 @@ | |
SimpleCov.start | ||
|
||
require 'cranky' | ||
require 'active_model' | ||
|
||
RSpec.configure do |config| | ||
config.expect_with(:rspec) { |c| c.syntax = :should } | ||
end | ||
|
||
class TestClass | ||
attr_accessor :valid | ||
include ActiveModel::Validations | ||
|
||
attr_accessor :required_attr | ||
|
||
validates_presence_of :required_attr | ||
|
||
def save | ||
@saved = true | ||
|
@@ -18,14 +23,6 @@ def saved? | |
!!@saved | ||
end | ||
|
||
def valid? | ||
@valid | ||
end | ||
|
||
def errors | ||
"some validation errors" | ||
end | ||
|
||
def attributes | ||
self.instance_variables | ||
end | ||
|
@@ -59,7 +56,6 @@ def user_manually | |
u.unique = "value#{n}" | ||
u.email = "[email protected]" | ||
u.address = Factory.build(:address) | ||
u.valid = true | ||
u | ||
end | ||
|
||
|
@@ -69,8 +65,7 @@ def user_by_define | |
:role => :user, | ||
:unique => "value#{n}", | ||
:email => "[email protected]", | ||
:address => Factory.create(:address), | ||
:valid => true | ||
:address => Factory.create(:address) | ||
u.argument_received = true if options[:argument_supplied] | ||
u | ||
end | ||
|
@@ -86,8 +81,7 @@ def admin_by_define | |
|
||
def address | ||
define :address => "25 Wisteria Lane", | ||
:city => "New York", | ||
:valid => true | ||
:city => "New York" | ||
end | ||
|
||
def user_hash | ||
|