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
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'file_decrypter' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} |
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
def show | |
if current_user | |
unless current_user.stocks? | |
redirect_to root_path, :notice => "You need to add some stocks first." | |
end | |
@stocks = current_user.stocks | |
else | |
redirect_to new_user_session_path | |
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
# As the method, I have tried :put and :update. | |
= button_to 'Update all quotes', admin_panel_path, :method => :put |
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
%h2 Admin Control Panel | |
%br/ | |
%div{ :style => "float:left;" } | |
%h3 Add stocks | |
%br/ | |
= form_tag(new_admin_stock_path, :method => :get) do | |
= label_tag(:symbol, "Symbols") | |
%br/ | |
= text_area_tag(:symbol, nil, :cols => 30, :rows => 10) | |
%br/ |
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
def index | |
if current_user.admin | |
@stocks = Stock.all | |
else | |
redirect_to root_path | |
flash[:error] = "You must be an administrator to access this page!" | |
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
$ bundle exec rake db:create | |
(in /home/david/work/xrono) | |
rake aborted! | |
Lemonade is deprecated now. You may want to use Compass Sprites from now on. More information: | |
https://github.com/hagenburger/lemonade | |
/home/david/.rvm/gems/ruby-1.9.2-p180/gems/lemonade-0.3.5/lib/README.md | |
/home/david/work/xrono/Rakefile:4:in `require' | |
(See full trace by running task with --trace) |
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
module Sorcery | |
module Model | |
module Submodules | |
# The API Token submodule automatically generates a token that can | |
# be used to login to the website on every visit. | |
module APIToken | |
def self.included(base) | |
base.sorcery_config.class_eval do | |
attr_accessor :api_token_attribute_name, # the attribute in the model class. | |
:api_token_expires_at_attribute_name, # the expires attribute in the model class. |
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 Ability | |
include CanCan::Ability | |
def initialize(user) | |
user ||= User.new # guest user (not logged in) | |
if user.admin? | |
can :manage, :all | |
elsif user.manager? | |
can :manage, Client, Client.where(:user_id => user.id) do |client| | |
client.user_id == user.id |
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
$ rake cucumber | |
/home/david/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -S bundle exec cucumber --profile default | |
Using the default profile... | |
Feature: API Authorization | |
Background: # features/api/authorization.feature:3 | |
Given a role exists with name: "manager" # features/step_definitions/role_steps.rb:1 | |
And there is a user with username "manager-user" and API token "b390294aad6811e0a7cc0030679f1d6a" # features/step_definitions/user_steps.rb:1 | |
And the user with username "manager-user" has role a manager role # features/step_definitions/user_steps.rb:5 | |
And the user with username "manager-user" has a client named "Manager Client 1" # features/step_definitions/client_steps.rb:1 |
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
Installing rmagick (2.13.1) with native extensions /home/david/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) | |
/home/david/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb | |
checking for Ruby version >= 1.8.5... yes | |
checking for gcc... yes | |
checking for Magick-config... no | |
Can't install RMagick 2.13.1. Can't find Magick-config in /home/david/.rvm/gems/ruby-1.9.2-p180/bin:/home/david/.rvm/gems/ruby-1.9.2-p180@global/bin:/home/david/.rvm/rubies/ruby-1.9.2-p180/bin:/home/david/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/bin:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/bin | |
*** extconf.rb failed *** | |
Could not create Makefile due to some reason, probably lack of |
OlderNewer