$ rails g model User
belongs_to
has_one
| pl: | |
| devise: | |
| confirmations: | |
| confirmed: "Twój adres e-mail został pomyślnie potwierdzony." | |
| send_instructions: "W ciągu kilku minut otrzymasz e-mail z instrukcjami, jak potwierdzić swój adres e-mail." | |
| send_paranoid_instructions: "Jeśli Twój adres e-mail istnieje w naszej bazie danych, otrzymasz e-mail z instrukcjami, jak potwierdzić swój adres e-mail w ciągu kilku minut." | |
| failure: | |
| already_authenticated: "Jesteś już zalogowany." | |
| inactive: "Twoje konto nie jest jeszcze aktywne." | |
| invalid: "Nieprawidłowy %{authentication_keys} lub hasło." |
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| # in spec/support/omniauth_macros.rb | |
| module OmniauthMacros | |
| def mock_auth_hash | |
| # The mock_auth configuration allows you to set per-provider (or default) | |
| # authentication hashes to return during integration testing. | |
| OmniAuth.config.mock_auth[:twitter] = { | |
| 'provider' => 'twitter', | |
| 'uid' => '123545', | |
| 'user_info' => { | |
| 'name' => 'mockuser', |
| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # @kyletcarlson | |
| # | |
| # This skeleton also assumes you're using the following gems: |
| rails g scaffold Book title:string description:text | |
| rails g scaffold Pubhouse title:string address:text | |
| rails g model BookPubhouse book_id:integer pubhouse_id:integer | |
| rake db:migrate |
| # MySQL. Versions 4.1 and 5.0 are recommended. | |
| # | |
| # Install the MySQL driver: | |
| # gem install mysql2 | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: | |
| adapter: mysql2 | |
| encoding: utf8 |
| require 'csv' | |
| CSV.foreach("test.csv") do |row| | |
| username = row[0] | |
| id = row[1] | |
| roles = row[2..-1] | |
| puts "User: #{username} id: #{id} has following role:" | |
| roles.each do |r| | |
| puts r |