spec
|--- apis #do not put into controllers folder.
|--- your_api_test_spec.rb
|--- controllers
|--- models
|--- factories
|--- views
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
namespace :db do | |
desc "load data from csv" | |
task :load_csv_data => :environment do | |
require 'fastercsv' | |
FasterCSV.foreach("importdata/tarife.csv", :headers => true, :col_sep => ',') do |row| | |
Anbieter.find_or_create_by_name( | |
:name => row['Anbieter_Name'] | |
:hotline => row['Hotline'], | |
:email => row['Email'] |
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 'will_paginate/array' | |
describe "recurrences/index" do | |
let(:recurrences) do [ | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-05"), | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-12"), | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-19") | |
] | |
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
require 'will_paginate/array' | |
describe "recurrences/index" do | |
let(:recurrences) do [ | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-05"), | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-12"), | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-19") | |
] | |
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
describe PostPolicy do | |
let(:scope) { Post.where(:published => true } | |
subject(:policy_scope) { PostPolicy::Scope.new(user, scope).resolve } | |
permissions ".scope" do | |
context "for an ordinary user" | |
let(:user) { User.new(:admin => false) } | |
it "hides unpublished post" do | |
post = Post.create(:published => false) |
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
# Rake task to help migrating a rails 3 app to rails 4 strong_parameters. | |
# The task generates source code for helper methods for each model class | |
# to 'permit' the attributes. | |
# The generated methods are intended as starting point to copy&paste in the | |
# controller and than edit the permitted attributs. | |
# Some common names of non-editable attributes are already filtered, | |
# like 'id', 'password' or 'created_at'. | |
# The output is written to stdout so you can pipe it into a file | |
# | |
# Dependencies: |
destination (10.0.0.3) <- |NAT| <- source (192.168.1.105)
-
SSH from the destination to the source (with public ip)
ssh -f -N -R 19999:localhost:22 [email protected]
-
SSH from source to destination through above tunel
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
## Context + metadata | |
shared_context 'Logged as a user', role: true do | |
let(:user) { |example| create :user, example.metadata[:role] } | |
before { login_as user } | |
end | |
scenario "Login as a client", role: :client | |
scenario "Login as a customer", role: :customer | |
scenario "Login as an admin", role: :admin |
OlderNewer