Created
August 8, 2011 03:00
-
-
Save maciejsmolinski/1131131 to your computer and use it in GitHub Desktop.
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
module ClassHelpers | |
def new_user | |
User.new | |
end | |
def new_valid_user | |
User.new(valid_user_params) | |
end | |
def create_valid_user(params = {}) | |
User.create(valid_user_params.merge params) | |
end | |
def valid_user_params | |
{ :username => 'testemail', | |
:email => 'testemail@gmail.com', | |
:password => 'password', | |
:birth_date => '1990-01-01' } | |
end | |
def new_battle | |
Battle.new | |
end | |
def new_valid_battle | |
Battle.new(valid_battle_params) | |
end | |
def create_valid_battle(params = {}) | |
Battle.create(valid_battle_params.merge params) | |
end | |
def valid_battle_params | |
{ :type_id => 1, | |
:rule_id => 1, | |
:lasts_for => 3, | |
:finish_date => Date.today + 5.days | |
} | |
end | |
def new_battle_entity | |
BattleEntity.new | |
end | |
def new_valid_battle_entity | |
BattleEntity.new(valid_battle_entity_params) | |
end | |
def create_valid_battle_entity(params = {}) | |
BattleEntity.create(valid_battle_entity_params.merge params) | |
end | |
def valid_battle_entity_params | |
{ :user_id => 1, | |
:battle_id => 1, | |
:video_id => nil | |
} | |
end | |
def valid_battle_entity_video_id | |
1322093 | |
end | |
def invalid_battle_entity_video_id | |
1 | |
end | |
def stub_battle_entity_network_activity! | |
BattleEntity.stub!(:video_exists?).with(valid_battle_entity_video_id).and_return(true) | |
BattleEntity.stub!(:video_exists?).with(invalid_battle_entity_video_id).and_return(false) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment