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
class AddAttendeePage | |
def add_attendee_with_details | |
fill_attendee_details | |
fill_order_form | |
click_add_attendee | |
end | |
private | |
def fill_attendee_details |
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
class AddAttendeePage | |
def add_attendee_with_details | |
fill_in('user_email', with: 'test@gmail.com') | |
fill_in('user_first_name', with: 'test') | |
fill_in('user_last_name', with: 'test') | |
fill_order_form | |
click_add_attendee | |
end | |
private |
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
# A controller | |
module Api::V2 | |
module Controllers::ZonesRecords | |
class Create | |
include Hanami::Action | |
def call(params) | |
@zone = DomainFinder.find!( | |
params[:zone_id], authentication_context).zone |
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
class Greeter | |
def greet(user) | |
user_name_decorator = UserNameDecorator.new(user) | |
@greeting = user_name_decorator.dear_mr_user | |
@greeting << "\n" | |
@greeting << "Bla bla bla" | |
... | |
@greeting << "\n" | |
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
class UsersController < ApplicationController | |
def show | |
@user = User.find(params[:id]) | |
... | |
end | |
def edit | |
@user = User.find(params[:id]) | |
... | |
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
class ConfigFile | |
FILE_PATH = 'path/to/config.cfg' | |
def write_player_state(state) | |
File.open(FILE_PATH, 'w') do |f| | |
f.write('player_state: #{state}') | |
end | |
end | |
def read_player_state |
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
class UsersController < ApplicationController | |
before_filter :set_user, only: [:show, :edit, :update] | |
def show | |
end | |
def edit | |
end | |
def update |
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
class Game | |
def save_player_state | |
File.open('path/to/config.cfg', 'a') do |f| | |
f.write('player_state: near_window') | |
end | |
end | |
end | |
class Player | |
def read_state |
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
class LoginPage | |
include Capybara::DSL | |
include Rails.application.routes.url_helpers | |
def visit | |
super login_path | |
end | |
def login_with(params = {}) | |
fill_login_form(params) |
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
require "spec_helper" | |
feature "Authentication" do | |
before do | |
Traver.create(user: { email: "walter@white.com", password: "walter" }) | |
end | |
let(:login_page) { LoginPage.new } | |
scenario "User logs in successfully by entering email and password" do |
NewerOlder