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
describe User do | |
describe "other_users"do | |
it "should return other users" do | |
User.delete_all | |
me = Factory(:user) | |
other_one = Factory(:user) | |
other_two = Factory(:user) | |
User.other_users(me).all.should_not be_empty |
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' | |
describe User do | |
describe "other_users" do | |
before { | |
User.delete_all | |
@me = Factory(:user) | |
@other_one = Factory(:user) | |
@other_two = Factory(:user) |
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 SectionsController < ApplicationController | |
load_and_authorize_resource | |
expose(:section) | |
expose(:sections) { search.paginate(:page => params[:page]) } | |
expose(:search) { Section.search(params[:search]) } | |
def create | |
if section.save |
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 FloorsController < ApplicationController | |
load_and_authorize_resource | |
expose(:floor) | |
expose(:floors) { search.paginate(:page => params[:page]) } | |
expose(:search) { Floor.search(params[:search]) } | |
def create | |
if floor.save |
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 JobSymbolsController < ApplicationController | |
expose(:job_symbol) | |
expose(:job_symbols) { search.paginate(:page => params[:page]) } | |
expose(:search) { JobSymbol.search(params[:search]) } | |
def create | |
if job_symbol.save | |
redirect_to(job_symbols_url) | |
else |
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' | |
describe JobSymbolsController do | |
before do | |
JobSymbol.stub!(:new).and_return(@job_symbol = mock_model(JobSymbol)) | |
JobSymbol.stub!(:search).and_return(@search = []) | |
@search.stub!(:paginate).and_return(@job_symbols = []) | |
@request_params = { :search => Hash.new, :page => 10, :job_symbol => {} } | |
@job_symbol.stub!(:attributes=) | |
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 JobSymbolsController < ApplicationController | |
expose(:job_symbol) | |
expose(:job_symbols) { search.paginate(:page => params[:page]) } | |
expose(:search) { JobSymbol.search(params[:search]) } | |
def index | |
end | |
def new |
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
Funcionalidade: Gerenciamento de Símbolos | |
Para efetuar o gerenciamento de símbolos | |
Como um usuário | |
Eu quero cadastrar, alterar e excluir símbolos | |
Cenário: Listagem | |
Dado que eu tenho símbolos chamados CIT-6, SIM-1 | |
Quando eu vou para listagem de símbolos | |
Então eu devo ver "CIT-6" | |
E eu devo ver "SIM-1" |
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
# Single-line step scoper | |
Quando /^(.*) dentro de ([^:]+)$/ do |step, parent| | |
with_scope(parent) { Quando step } | |
end | |
# Multi-line step scoper | |
Quando /^(.*) dentro de ([^:]+):$/ do |step, parent, table_or_string| | |
with_scope(parent) { Quando "#{step}:", table_or_string } | |
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
module CrudFor | |
def crud_for(model) | |
expose(model.to_sym) | |
expose(model.to_s.pluralize.to_sym) { search.paginate(:page => params[:page]) } | |
expose(:search) { model.to_s.capitalize.constantize.search(params[:search]) } | |
self.class_eval %" | |
def create | |
if #{model}.save | |
redirect_to #{model.to_s.pluralize}_url |
OlderNewer