Created
August 28, 2012 17:04
-
-
Save jsanders/3500774 to your computer and use it in GitHub Desktop.
Rspec shared examples for ActiveModel lint
This file contains hidden or 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
class ::Something | |
def self.model_name | |
model_name = '' | |
def model_name.human() '' end | |
def model_name.singular() '' end | |
def model_name.plural() '' end | |
model_name | |
end | |
def persisted? | |
false | |
end | |
def to_key | |
persisted? ? [] : nil | |
end | |
def to_param | |
persisted? ? '' : nil | |
end | |
def valid? | |
false | |
end | |
def to_partial_path | |
'' | |
end | |
def errors | |
errors = [] | |
def errors.full_messages() [] end | |
errors | |
end | |
end |
This file contains hidden or 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
require 'something' | |
require 'shared_examples_for_active_model' | |
describe ::Something do | |
it_behaves_like "ActiveModel" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment