Nicolae Claudius
13 years ago
124 changed files with 1032 additions and 1563 deletions
@ -0,0 +1,21 @@
|
||||
class PermissionsController < ApplicationController |
||||
active_scaffold :permission do |conf| |
||||
conf.actions.exclude :show, :search |
||||
conf.columns = [:domain, :user, :user_email] |
||||
conf.list.columns = [:domain, :user, :user_email] |
||||
conf.create.columns = [:domain, :user_email] |
||||
conf.update.columns = [:domain, :user_email] |
||||
conf.columns[:user_email].form_ui = :virtual |
||||
conf.columns[:user_email].description = 'user\'s email address, to share with. Ex. jhon.doe@domain.com' |
||||
conf.create.link.label = 'Share Domain' |
||||
# conf.columns[:user_email].search_sql = 'user.email' |
||||
# conf.columns[:user].search_sql = 'CONCAT(first_name, ' ', last_name)' |
||||
end |
||||
before_filter :ensure_nested_under_domain |
||||
|
||||
protected |
||||
|
||||
def beginning_of_chain |
||||
super.readonly(false) |
||||
end |
||||
end |
@ -0,0 +1,25 @@
|
||||
# some common bits of code for records related controllers |
||||
module RecordsControllerCommon |
||||
extend ActiveSupport::Concern |
||||
|
||||
included do |
||||
before_filter :ensure_nested_under_domain |
||||
end |
||||
|
||||
protected |
||||
|
||||
def before_create_save(record) |
||||
record.domain = nested_parent_record |
||||
record.user = record.domain_user |
||||
end |
||||
|
||||
def nested_via_records? |
||||
nested? && nested.association && nested.association.collection? && nested.association.name == :records |
||||
end |
||||
|
||||
# override to close create form after success |
||||
# RecordsController is the only one that does not really need this |
||||
def render_parent? |
||||
nested_singular_association? # || params[:parent_sti] |
||||
end |
||||
end |
@ -0,0 +1,32 @@
|
||||
class Permission < ActiveRecord::Base |
||||
stampable |
||||
|
||||
belongs_to :domain, :inverse_of => :permissions |
||||
belongs_to :user, :inverse_of => :permissions |
||||
|
||||
validates :domain_id, :presence => true |
||||
validates :user_id, :presence => true, :uniqueness => { |
||||
:scope => :domain_id, |
||||
:message => "already is permitted" |
||||
} |
||||
validates :user, :presence => { |
||||
:if => lambda {@user_email.present?}, |
||||
:message => "with given email was not found" |
||||
} |
||||
validate do |
||||
errors[:user] = 'cannot be yourself' if user_id == domain.user_id |
||||
end |
||||
|
||||
def user_email |
||||
@user_email || user.try(:email) |
||||
end |
||||
|
||||
def user_email=(email) |
||||
@user_email = email |
||||
self.user = User.find_by_email(email) |
||||
end |
||||
|
||||
def to_label |
||||
user.try(:email) || @user_email || '-' |
||||
end |
||||
end |
@ -0,0 +1,114 @@
|
||||
# https://gist.github.com/1523940 |
||||
module CanCan |
||||
|
||||
module ModelAdapters |
||||
class ActiveRecordAdapter < AbstractAdapter |
||||
|
||||
def self.override_condition_matching?(subject, name, value) |
||||
name.kind_of?(Squeel::Nodes::Predicate) if defined? Squeel |
||||
end |
||||
|
||||
def self.matches_condition?(subject, name, value) |
||||
subject_value = subject.send(name.expr) |
||||
method_name = name.method_name.to_s |
||||
if method_name.ends_with? "_any" |
||||
value.any? { |v| squeel_match? subject_value, method_name.sub("_any", ""), v } |
||||
elsif method_name.ends_with? "_all" |
||||
value.all? { |v| squeel_match? subject_value, method_name.sub("_all", ""), v } |
||||
else |
||||
squeel_match? subject_value, name.method_name, value |
||||
end |
||||
end |
||||
|
||||
def self.squeel_match?(subject_value, method, value) |
||||
case method.to_sym |
||||
when :eq then subject_value == value |
||||
when :not_eq then subject_value != value |
||||
when :in then value.include?(subject_value) |
||||
when :not_in then !value.include?(subject_value) |
||||
when :lt then subject_value < value |
||||
when :lteq then subject_value <= value |
||||
when :gt then subject_value > value |
||||
when :gteq then subject_value >= value |
||||
when :matches then subject_value =~ Regexp.new("^" + Regexp.escape(value).gsub("%", ".*") + "$", true) |
||||
when :does_not_match then !squeel_match?(subject_value, :matches, value) |
||||
else raise NotImplemented, "The #{method} Squeel condition is not supported." |
||||
end |
||||
end |
||||
|
||||
def tableized_conditions(conditions, model_class = @model_class) |
||||
return conditions unless conditions.kind_of? Hash |
||||
conditions.inject({}) do |result_hash, (name, value)| |
||||
name_sym = case name |
||||
when Symbol then name |
||||
when Squeel::Nodes::Join then name._name |
||||
when Squeel::Nodes::Predicate then name.expr |
||||
else raise name |
||||
end |
||||
if value.kind_of? Hash |
||||
reflection = model_class.reflect_on_association(name_sym) |
||||
association_class = reflection.class_name.constantize |
||||
name_sym = reflection.table_name.to_sym |
||||
value = tableized_conditions(value, association_class) |
||||
end |
||||
result_hash[name_sym] = value |
||||
result_hash |
||||
end |
||||
end |
||||
|
||||
private |
||||
|
||||
# override to fix overwrites |
||||
# do not write existing hashes using empty hashes |
||||
def merge_joins(base, add) |
||||
add.each do |name, nested| |
||||
if base[name].is_a?(Hash) && nested.present? |
||||
merge_joins(base[name], nested) |
||||
elsif !base[name].is_a?(Hash) || nested.present? |
||||
base[name] = nested |
||||
end |
||||
end |
||||
end |
||||
|
||||
end |
||||
end |
||||
|
||||
class Rule |
||||
# allow Squeel |
||||
def matches_conditions_hash?(subject, conditions = @conditions) |
||||
if conditions.empty? |
||||
true |
||||
else |
||||
if model_adapter(subject).override_conditions_hash_matching? subject, conditions |
||||
model_adapter(subject).matches_conditions_hash? subject, conditions |
||||
else |
||||
conditions.all? do |name, value| |
||||
if model_adapter(subject).override_condition_matching? subject, name, value |
||||
model_adapter(subject).matches_condition? subject, name, value |
||||
else |
||||
method_name = case name |
||||
when Symbol then name |
||||
when Squeel::Nodes::Join then name._name |
||||
when Squeel::Nodes::Predicate then name.expr |
||||
else raise name |
||||
end |
||||
attribute = subject.send(method_name) |
||||
if value.kind_of?(Hash) |
||||
if attribute.kind_of? Array |
||||
attribute.any? { |element| matches_conditions_hash? element, value } |
||||
else |
||||
!attribute.nil? && matches_conditions_hash?(attribute, value) |
||||
end |
||||
elsif value.kind_of?(Array) || value.kind_of?(Range) |
||||
value.include? attribute |
||||
else |
||||
attribute == value |
||||
end |
||||
end |
||||
end |
||||
end |
||||
end |
||||
end |
||||
end |
||||
|
||||
end |
@ -0,0 +1,12 @@
|
||||
Squeel.configure do |config| |
||||
# To load hash extensions (to allow for AND (&), OR (|), and NOT (-) against |
||||
# hashes of conditions) |
||||
config.load_core_extensions :hash |
||||
|
||||
# To load symbol extensions (for a subset of the old MetaWhere functionality, |
||||
# via ARel predicate methods on Symbols: :name.matches, etc) |
||||
# config.load_core_extensions :symbol |
||||
|
||||
# To load both hash and symbol extensions |
||||
config.load_core_extensions :hash, :symbol |
||||
end |
@ -0,0 +1,12 @@
|
||||
class CreatePermissions < ActiveRecord::Migration |
||||
def change |
||||
create_table :permissions do |t| |
||||
t.references :domain # the domain to whom permission is being given |
||||
t.references :user # the user newly permitted to manage the domain |
||||
|
||||
t.timestamps |
||||
end |
||||
add_index :permissions, :domain_id |
||||
add_index :permissions, :user_id |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class AddNameReversedToDomains < ActiveRecord::Migration |
||||
def up |
||||
# used for "%" search indexing in an ancestry fashion (materialized path pattern) |
||||
# http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html |
||||
add_column :domains, :name_reversed, :string, :limit => 255 |
||||
execute "UPDATE domains SET name_reversed = REVERSE(name)" |
||||
change_column :domains, :name_reversed, :string, :limit => 255, :null => false |
||||
add_index :domains, :name_reversed |
||||
end |
||||
|
||||
def down |
||||
remove_index :domains, :column => :name_reversed |
||||
remove_column :domains, :name_reversed |
||||
end |
||||
end |
@ -0,0 +1,31 @@
|
||||
class AddUserstampsToModels < ActiveRecord::Migration |
||||
def change |
||||
add_column :users, :created_by_id, :integer |
||||
add_column :users, :updated_by_id, :integer |
||||
execute "UPDATE users SET created_by_id = id, updated_by_id = id" |
||||
|
||||
add_column :domains, :created_by_id, :integer |
||||
add_column :domains, :updated_by_id, :integer |
||||
execute "UPDATE domains SET created_by_id = user_id, updated_by_id = user_id" |
||||
|
||||
add_column :records, :created_by_id, :integer |
||||
add_column :records, :updated_by_id, :integer |
||||
execute <<-SQL |
||||
UPDATE records |
||||
LEFT JOIN domains ON records.domain_id = domains.id |
||||
SET |
||||
records.created_by_id = IFNULL(records.user_id, domains.user_id), |
||||
records.updated_by_id = IFNULL(records.user_id, domains.user_id) |
||||
SQL |
||||
|
||||
add_column :permissions, :created_by_id, :integer |
||||
add_column :permissions, :updated_by_id, :integer |
||||
execute <<-SQL |
||||
UPDATE permissions |
||||
LEFT JOIN domains ON permissions.domain_id = domains.id |
||||
SET |
||||
permissions.created_by_id = domains.user_id, |
||||
permissions.updated_by_id = domains.user_id |
||||
SQL |
||||
end |
||||
end |
@ -1,5 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe DashboardController do |
||||
|
||||
end |
@ -1,157 +1,178 @@
|
||||
require 'spec_helper' |
||||
|
||||
# This spec was generated by rspec-rails when you ran the scaffold generator. |
||||
# It demonstrates how one might use RSpec to specify the controller code that |
||||
# was generated by Rails when you ran the scaffold generator. |
||||
# |
||||
# It assumes that the implementation code is generated by the rails scaffold |
||||
# generator. If you are using any extension libraries to generate different |
||||
# controller code, this generated spec may or may not pass. |
||||
# |
||||
# It only uses APIs available in rails and/or rspec-rails. There are a number |
||||
# of tools you can use to make these specs even more expressive, but we're |
||||
# sticking to rails and rspec-rails APIs to keep things simple and stable. |
||||
# |
||||
# Compared to earlier versions of this generator, there is very limited use of |
||||
# stubs and message expectations in this spec. Stubs are only used when there |
||||
# is no simpler way to get a handle on the object needed for the example. |
||||
# Message expectations are only used when there is no simpler way to specify |
||||
# that an instance is receiving a specific message. |
||||
|
||||
describe DomainsController do |
||||
|
||||
context "wiring" do |
||||
include_context "data" |
||||
|
||||
# a domain who's parent domain is not in our system |
||||
context "domain" do |
||||
before do |
||||
sign_in user |
||||
end |
||||
|
||||
# This should return the minimal set of attributes required to create a valid |
||||
# Domain. As you add validations to Domain, be sure to |
||||
# update the return value of this method accordingly. |
||||
def valid_attributes |
||||
{} |
||||
end |
||||
|
||||
describe "GET index" do |
||||
it "assigns all domains as @domains" do |
||||
domain = Domain.create! valid_attributes |
||||
get :index |
||||
assigns(:domains).should eq([domain]) |
||||
it "is wired with the current user by #new_model" do |
||||
@controller.send(:new_model).user.should == user |
||||
end |
||||
|
||||
it "is wired with the current user by #before_create_save" do |
||||
domain = build(:domain) |
||||
@controller.send(:before_create_save, domain) |
||||
domain.user.should == user |
||||
end |
||||
end |
||||
end |
||||
|
||||
describe "GET show" do |
||||
it "assigns the requested domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
get :show, :id => domain.id.to_s |
||||
assigns(:domain).should eq(domain) |
||||
|
||||
# a domain who's parent domain is in our system |
||||
context "subdomain" do |
||||
before do |
||||
sign_in user2 |
||||
end |
||||
|
||||
it "is wired with the user of the parent domain by #before_create_save" do |
||||
subdomain = build(:domain, :user => user2, :name => "x.#{domain.name}") |
||||
@controller.send(:before_create_save, subdomain) |
||||
subdomain.user.should == user |
||||
end |
||||
end |
||||
|
||||
end |
||||
end |
||||
|
||||
describe "GET new" do |
||||
it "assigns a new domain as @domain" do |
||||
get :new |
||||
assigns(:domain).should be_a_new(Domain) |
||||
end |
||||
# TODO implement me |
||||
__END__ |
||||
|
||||
# This should return the minimal set of attributes required to create a valid |
||||
# Domain. As you add validations to Domain, be sure to |
||||
# update the return value of this method accordingly. |
||||
def valid_attributes |
||||
{} |
||||
end |
||||
|
||||
describe "GET index" do |
||||
it "assigns all domains as @domains" do |
||||
domain = Domain.create! valid_attributes |
||||
get :index |
||||
assigns(:domains).should eq([domain]) |
||||
end |
||||
end |
||||
|
||||
describe "GET edit" do |
||||
it "assigns the requested domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
get :edit, :id => domain.id.to_s |
||||
assigns(:domain).should eq(domain) |
||||
end |
||||
describe "GET show" do |
||||
it "assigns the requested domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
get :show, :id => domain.id.to_s |
||||
assigns(:domain).should eq(domain) |
||||
end |
||||
end |
||||
|
||||
describe "POST create" do |
||||
describe "with valid params" do |
||||
it "creates a new Domain" do |
||||
expect { |
||||
post :create, :domain => valid_attributes |
||||
}.to change(Domain, :count).by(1) |
||||
end |
||||
describe "GET new" do |
||||
it "assigns a new domain as @domain" do |
||||
get :new |
||||
assigns(:domain).should be_a_new(Domain) |
||||
end |
||||
end |
||||
|
||||
it "assigns a newly created domain as @domain" do |
||||
post :create, :domain => valid_attributes |
||||
assigns(:domain).should be_a(Domain) |
||||
assigns(:domain).should be_persisted |
||||
end |
||||
describe "GET edit" do |
||||
it "assigns the requested domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
get :edit, :id => domain.id.to_s |
||||
assigns(:domain).should eq(domain) |
||||
end |
||||
end |
||||
|
||||
it "redirects to the created domain" do |
||||
describe "POST create" do |
||||
describe "with valid params" do |
||||
it "creates a new Domain" do |
||||
expect { |
||||
post :create, :domain => valid_attributes |
||||
response.should redirect_to(Domain.last) |
||||
end |
||||
}.to change(Domain, :count).by(1) |
||||
end |
||||
|
||||
describe "with invalid params" do |
||||
it "assigns a newly created but unsaved domain as @domain" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
post :create, :domain => {} |
||||
assigns(:domain).should be_a_new(Domain) |
||||
end |
||||
it "assigns a newly created domain as @domain" do |
||||
post :create, :domain => valid_attributes |
||||
assigns(:domain).should be_a(Domain) |
||||
assigns(:domain).should be_persisted |
||||
end |
||||
|
||||
it "re-renders the 'new' template" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
post :create, :domain => {} |
||||
response.should render_template("new") |
||||
end |
||||
it "redirects to the created domain" do |
||||
post :create, :domain => valid_attributes |
||||
response.should redirect_to(Domain.last) |
||||
end |
||||
end |
||||
|
||||
describe "PUT update" do |
||||
describe "with valid params" do |
||||
it "updates the requested domain" do |
||||
domain = Domain.create! valid_attributes |
||||
# Assuming there are no other domains in the database, this |
||||
# specifies that the Domain created on the previous line |
||||
# receives the :update_attributes message with whatever params are |
||||
# submitted in the request. |
||||
Domain.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) |
||||
put :update, :id => domain.id, :domain => {'these' => 'params'} |
||||
end |
||||
describe "with invalid params" do |
||||
it "assigns a newly created but unsaved domain as @domain" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
post :create, :domain => {} |
||||
assigns(:domain).should be_a_new(Domain) |
||||
end |
||||
|
||||
it "assigns the requested domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
put :update, :id => domain.id, :domain => valid_attributes |
||||
assigns(:domain).should eq(domain) |
||||
end |
||||
it "re-renders the 'new' template" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
post :create, :domain => {} |
||||
response.should render_template("new") |
||||
end |
||||
end |
||||
end |
||||
|
||||
it "redirects to the domain" do |
||||
domain = Domain.create! valid_attributes |
||||
put :update, :id => domain.id, :domain => valid_attributes |
||||
response.should redirect_to(domain) |
||||
end |
||||
describe "PUT update" do |
||||
describe "with valid params" do |
||||
it "updates the requested domain" do |
||||
domain = Domain.create! valid_attributes |
||||
# Assuming there are no other domains in the database, this |
||||
# specifies that the Domain created on the previous line |
||||
# receives the :update_attributes message with whatever params are |
||||
# submitted in the request. |
||||
Domain.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) |
||||
put :update, :id => domain.id, :domain => {'these' => 'params'} |
||||
end |
||||
|
||||
describe "with invalid params" do |
||||
it "assigns the domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => domain.id.to_s, :domain => {} |
||||
assigns(:domain).should eq(domain) |
||||
end |
||||
it "assigns the requested domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
put :update, :id => domain.id, :domain => valid_attributes |
||||
assigns(:domain).should eq(domain) |
||||
end |
||||
|
||||
it "re-renders the 'edit' template" do |
||||
domain = Domain.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => domain.id.to_s, :domain => {} |
||||
response.should render_template("edit") |
||||
end |
||||
it "redirects to the domain" do |
||||
domain = Domain.create! valid_attributes |
||||
put :update, :id => domain.id, :domain => valid_attributes |
||||
response.should redirect_to(domain) |
||||
end |
||||
end |
||||
|
||||
describe "DELETE destroy" do |
||||
it "destroys the requested domain" do |
||||
describe "with invalid params" do |
||||
it "assigns the domain as @domain" do |
||||
domain = Domain.create! valid_attributes |
||||
expect { |
||||
delete :destroy, :id => domain.id.to_s |
||||
}.to change(Domain, :count).by(-1) |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => domain.id.to_s, :domain => {} |
||||
assigns(:domain).should eq(domain) |
||||
end |
||||
|
||||
it "redirects to the domains list" do |
||||
it "re-renders the 'edit' template" do |
||||
domain = Domain.create! valid_attributes |
||||
delete :destroy, :id => domain.id.to_s |
||||
response.should redirect_to(domains_url) |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Domain.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => domain.id.to_s, :domain => {} |
||||
response.should render_template("edit") |
||||
end |
||||
end |
||||
end |
||||
|
||||
describe "DELETE destroy" do |
||||
it "destroys the requested domain" do |
||||
domain = Domain.create! valid_attributes |
||||
expect { |
||||
delete :destroy, :id => domain.id.to_s |
||||
}.to change(Domain, :count).by(-1) |
||||
end |
||||
|
||||
it "redirects to the domains list" do |
||||
domain = Domain.create! valid_attributes |
||||
delete :destroy, :id => domain.id.to_s |
||||
response.should redirect_to(domains_url) |
||||
end |
||||
end |
||||
|
||||
end |
@ -1,157 +1,158 @@
|
||||
require 'spec_helper' |
||||
|
||||
# This spec was generated by rspec-rails when you ran the scaffold generator. |
||||
# It demonstrates how one might use RSpec to specify the controller code that |
||||
# was generated by Rails when you ran the scaffold generator. |
||||
# |
||||
# It assumes that the implementation code is generated by the rails scaffold |
||||
# generator. If you are using any extension libraries to generate different |
||||
# controller code, this generated spec may or may not pass. |
||||
# |
||||
# It only uses APIs available in rails and/or rspec-rails. There are a number |
||||
# of tools you can use to make these specs even more expressive, but we're |
||||
# sticking to rails and rspec-rails APIs to keep things simple and stable. |
||||
# |
||||
# Compared to earlier versions of this generator, there is very limited use of |
||||
# stubs and message expectations in this spec. Stubs are only used when there |
||||
# is no simpler way to get a handle on the object needed for the example. |
||||
# Message expectations are only used when there is no simpler way to specify |
||||
# that an instance is receiving a specific message. |
||||
|
||||
describe HostsController do |
||||
|
||||
# This should return the minimal set of attributes required to create a valid |
||||
# Host. As you add validations to Host, be sure to |
||||
# update the return value of this method accordingly. |
||||
def valid_attributes |
||||
{} |
||||
include_context "data" |
||||
|
||||
before do |
||||
sign_in user |
||||
@controller.stub(:nested_parent_record => host_domain) |
||||
end |
||||
|
||||
describe "GET index" do |
||||
it "assigns all hosts as @hosts" do |
||||
host = Host.create! valid_attributes |
||||
get :index |
||||
assigns(:hosts).should eq([host]) |
||||
end |
||||
it "#new_model is wired" do |
||||
@controller.send(:new_model).user.should == user |
||||
end |
||||
|
||||
it "#before_create_save wires" do |
||||
@controller.send(:before_create_save, host_a_record) |
||||
host_a_record.user.should == user |
||||
end |
||||
end |
||||
|
||||
describe "GET show" do |
||||
it "assigns the requested host as @host" do |
||||
host = Host.create! valid_attributes |
||||
get :show, :id => host.id.to_s |
||||
assigns(:host).should eq(host) |
||||
end |
||||
# TODO implement me |
||||
__END__ |
||||
|
||||
# This should return the minimal set of attributes required to create a valid |
||||
# Host. As you add validations to Host, be sure to |
||||
# update the return value of this method accordingly. |
||||
def valid_attributes |
||||
{} |
||||
end |
||||
|
||||
describe "GET index" do |
||||
it "assigns all hosts as @hosts" do |
||||
host = Host.create! valid_attributes |
||||
get :index |
||||
assigns(:hosts).should eq([host]) |
||||
end |
||||
end |
||||
|
||||
describe "GET new" do |
||||
it "assigns a new host as @host" do |
||||
get :new |
||||
assigns(:host).should be_a_new(Host) |
||||
end |
||||
describe "GET show" do |
||||
it "assigns the requested host as @host" do |
||||
host = Host.create! valid_attributes |
||||
get :show, :id => host.id.to_s |
||||
assigns(:host).should eq(host) |
||||
end |
||||
end |
||||
|
||||
describe "GET edit" do |
||||
it "assigns the requested host as @host" do |
||||
host = Host.create! valid_attributes |
||||
get :edit, :id => host.id.to_s |
||||
assigns(:host).should eq(host) |
||||
end |
||||
describe "GET new" do |
||||
it "assigns a new host as @host" do |
||||
get :new |
||||
assigns(:host).should be_a_new(Host) |
||||
end |
||||
end |
||||
|
||||
describe "POST create" do |
||||
describe "with valid params" do |
||||
it "creates a new Host" do |
||||
expect { |
||||
post :create, :host => valid_attributes |
||||
}.to change(Host, :count).by(1) |
||||
end |
||||
describe "GET edit" do |
||||
it "assigns the requested host as @host" do |
||||
host = Host.create! valid_attributes |
||||
get :edit, :id => host.id.to_s |
||||
assigns(:host).should eq(host) |
||||
end |
||||
end |
||||
|
||||
it "assigns a newly created host as @host" do |
||||
describe "POST create" do |
||||
describe "with valid params" do |
||||
it "creates a new Host" do |
||||
expect { |
||||
post :create, :host => valid_attributes |
||||
assigns(:host).should be_a(Host) |
||||
assigns(:host).should be_persisted |
||||
end |
||||
}.to change(Host, :count).by(1) |
||||
end |
||||
|
||||
it "redirects to the created host" do |
||||
post :create, :host => valid_attributes |
||||
response.should redirect_to(Host.last) |
||||
end |
||||
it "assigns a newly created host as @host" do |
||||
post :create, :host => valid_attributes |
||||
assigns(:host).should be_a(Host) |
||||
assigns(:host).should be_persisted |
||||
end |
||||
|
||||
describe "with invalid params" do |
||||
it "assigns a newly created but unsaved host as @host" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
post :create, :host => {} |
||||
assigns(:host).should be_a_new(Host) |
||||
end |
||||
|
||||
it "re-renders the 'new' template" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
post :create, :host => {} |
||||
response.should render_template("new") |
||||
end |
||||
it "redirects to the created host" do |
||||
post :create, :host => valid_attributes |
||||
response.should redirect_to(Host.last) |
||||
end |
||||
end |
||||
|
||||
describe "PUT update" do |
||||
describe "with valid params" do |
||||
it "updates the requested host" do |
||||
host = Host.create! valid_attributes |
||||
# Assuming there are no other hosts in the database, this |
||||
# specifies that the Host created on the previous line |
||||
# receives the :update_attributes message with whatever params are |
||||
# submitted in the request. |
||||
Host.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) |
||||
put :update, :id => host.id, :host => {'these' => 'params'} |
||||
end |
||||
|
||||
it "assigns the requested host as @host" do |
||||
host = Host.create! valid_attributes |
||||
put :update, :id => host.id, :host => valid_attributes |
||||
assigns(:host).should eq(host) |
||||
end |
||||
|
||||
it "redirects to the host" do |
||||
host = Host.create! valid_attributes |
||||
put :update, :id => host.id, :host => valid_attributes |
||||
response.should redirect_to(host) |
||||
end |
||||
describe "with invalid params" do |
||||
it "assigns a newly created but unsaved host as @host" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
post :create, :host => {} |
||||
assigns(:host).should be_a_new(Host) |
||||
end |
||||
|
||||
describe "with invalid params" do |
||||
it "assigns the host as @host" do |
||||
host = Host.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => host.id.to_s, :host => {} |
||||
assigns(:host).should eq(host) |
||||
end |
||||
|
||||
it "re-renders the 'edit' template" do |
||||
host = Host.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => host.id.to_s, :host => {} |
||||
response.should render_template("edit") |
||||
end |
||||
it "re-renders the 'new' template" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
post :create, :host => {} |
||||
response.should render_template("new") |
||||
end |
||||
end |
||||
end |
||||
|
||||
describe "DELETE destroy" do |
||||
it "destroys the requested host" do |
||||
describe "PUT update" do |
||||
describe "with valid params" do |
||||
it "updates the requested host" do |
||||
host = Host.create! valid_attributes |
||||
expect { |
||||
delete :destroy, :id => host.id.to_s |
||||
}.to change(Host, :count).by(-1) |
||||
# Assuming there are no other hosts in the database, this |
||||
# specifies that the Host created on the previous line |
||||
# receives the :update_attributes message with whatever params are |
||||
# submitted in the request. |
||||
Host.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) |
||||
put :update, :id => host.id, :host => {'these' => 'params'} |
||||
end |
||||
|
||||
it "redirects to the hosts list" do |
||||
it "assigns the requested host as @host" do |
||||
host = Host.create! valid_attributes |
||||
delete :destroy, :id => host.id.to_s |
||||
response.should redirect_to(hosts_url) |
||||
put :update, :id => host.id, :host => valid_attributes |
||||
assigns(:host).should eq(host) |
||||
end |
||||
|
||||
it "redirects to the host" do |
||||
host = Host.create! valid_attributes |
||||
put :update, :id => host.id, :host => valid_attributes |
||||
response.should redirect_to(host) |
||||
end |
||||
end |
||||
|
||||
describe "with invalid params" do |
||||
it "assigns the host as @host" do |
||||
host = Host.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => host.id.to_s, :host => {} |
||||
assigns(:host).should eq(host) |
||||
end |
||||
|
||||
it "re-renders the 'edit' template" do |
||||
host = Host.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Host.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => host.id.to_s, :host => {} |
||||
response.should render_template("edit") |
||||
end |
||||
end |
||||
end |
||||
|
||||
describe "DELETE destroy" do |
||||
it "destroys the requested host" do |
||||
host = Host.create! valid_attributes |
||||
expect { |
||||
delete :destroy, :id => host.id.to_s |
||||
}.to change(Host, :count).by(-1) |
||||
end |
||||
|
||||
it "redirects to the hosts list" do |
||||
host = Host.create! valid_attributes |
||||
delete :destroy, :id => host.id.to_s |
||||
response.should redirect_to(hosts_url) |
||||
end |
||||
end |
||||
|
||||
end |
||||
|
@ -1,5 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe PagesController do |
||||
|
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the AaaasHelper. For example: |
||||
# |
||||
# describe AaaasHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe AaaasHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the AsHelper. For example: |
||||
# |
||||
# describe AsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe AsHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the CnamesHelper. For example: |
||||
# |
||||
# describe CnamesHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe CnamesHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the DashboardHelper. For example: |
||||
# |
||||
# describe DashboardHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe DashboardHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the DomainsHelper. For example: |
||||
# |
||||
# describe DomainsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe DomainsHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the HostsHelper. For example: |
||||
# |
||||
# describe HostsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe HostsHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the MxesHelper. For example: |
||||
# |
||||
# describe MxesHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe MxesHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the NsHelper. For example: |
||||
# |
||||
# describe NsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe NsHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the PagesHelper. For example: |
||||
# |
||||
# describe PagesHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe PagesHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the RecordsHelper. For example: |
||||
# |
||||
# describe RecordsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe RecordsHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the SoAsHelper. For example: |
||||
# |
||||
# describe SoAsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe SoasHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the SrvsHelper. For example: |
||||
# |
||||
# describe SrvsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe SrvsHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
# Specs in this file have access to a helper object that includes |
||||
# the TxtsHelper. For example: |
||||
# |
||||
# describe TxtsHelper do |
||||
# describe "string concat" do |
||||
# it "concats two strings with spaces" do |
||||
# helper.concat_strings("this","that").should == "this that" |
||||
# end |
||||
# end |
||||
# end |
||||
describe TxtsHelper do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
end |
@ -0,0 +1,15 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe Permission do |
||||
include_context "data" |
||||
|
||||
it "validates selfness" do |
||||
permission.user_id = permission.domain.user_id |
||||
permission.should have(1).error_on(:user) |
||||
end |
||||
|
||||
it "validates unexsisting email" do |
||||
permission.user_email = "does.not@exist.in.db" |
||||
permission.should have(1).error_on(:user) |
||||
end |
||||
end |
@ -1,5 +1,8 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe User do |
||||
pending "add some examples to (or delete) #{__FILE__}" |
||||
include_context "data" |
||||
it "is valid" do |
||||
user.should be_valid |
||||
end |
||||
end |
||||
|
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Aaaas" do |
||||
describe "GET /aaaas" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get aaaas_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "As" do |
||||
describe "GET /as" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get as_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Cnames" do |
||||
describe "GET /cnames" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get cnames_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Domains" do |
||||
describe "GET /domains" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get domains_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Hosts" do |
||||
describe "GET /hosts" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get hosts_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Mxes" do |
||||
describe "GET /mxes" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get mxes_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Ns" do |
||||
describe "GET /ns" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get ns_index_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Records" do |
||||
describe "GET /records" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get records_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Soas" do |
||||
describe "GET /soas" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get soas_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Srvs" do |
||||
describe "GET /srvs" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get srvs_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "Txts" do |
||||
describe "GET /txts" do |
||||
it "works! (now write some real specs)" do |
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers |
||||
get txts_path |
||||
response.status.should be(200) |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,35 @@
|
||||
require "spec_helper" |
||||
|
||||
describe PermissionsController do |
||||
describe "routing" do |
||||
|
||||
it "routes to #index" do |
||||
get("/permissions").should route_to("permissions#index") |
||||
end |
||||
|
||||
it "routes to #new" do |
||||
get("/permissions/new").should route_to("permissions#new") |
||||
end |
||||
|
||||
it "routes to #show" do |
||||
get("/permissions/1").should route_to("permissions#show", :id => "1") |
||||
end |
||||
|
||||
it "routes to #edit" do |
||||
get("/permissions/1/edit").should route_to("permissions#edit", :id => "1") |
||||
end |
||||
|
||||
it "routes to #create" do |
||||
post("/permissions").should route_to("permissions#create") |
||||
end |
||||
|
||||
it "routes to #update" do |
||||
put("/permissions/1").should route_to("permissions#update", :id => "1") |
||||
end |
||||
|
||||
it "routes to #destroy" do |
||||
delete("/permissions/1").should route_to("permissions#destroy", :id => "1") |
||||
end |
||||
|
||||
end |
||||
end |
@ -1,40 +1,35 @@
|
||||
shared_context "data" do |
||||
let(:admin){create(:user)} # admin is a user that owns host domains |
||||
let(:user){create(:user)} # a regular user |
||||
let(:user2){create(:user)} |
||||
let(:user3){create(:user)} |
||||
|
||||
let(:user){create(:user)} |
||||
let(:ability){Ability.new(:user => user)} |
||||
let(:other_user){create(:user)} |
||||
let(:other_user_ability){Ability.new(:user => other_user)} |
||||
|
||||
let(:domain){ |
||||
domain = build(:domain, :user => user) |
||||
def make_domain(options) |
||||
domain = build(:domain, options) |
||||
domain.setup(FactoryGirl.generate(:email)) |
||||
domain.save! |
||||
domain.soa_record.update_serial! |
||||
domain |
||||
} |
||||
let(:a_record){create(:a, :content => '127.0.0.1', :domain => domain)} |
||||
let(:soa_record){domain.soa_record} |
||||
end |
||||
|
||||
# admin is a user that owns host domains |
||||
let(:admin){ |
||||
admin_user = create(:user, |
||||
:first_name => 'admin', |
||||
:last_name => 'admin', |
||||
:email => 'admin@entrydns.net', |
||||
:confirmed_at => Time.now |
||||
) |
||||
admin_user.confirm! |
||||
admin_user |
||||
} |
||||
let(:admin_ability){Ability.new(:user => admin)} |
||||
# user's domains |
||||
let(:domain){make_domain(:user => user)} |
||||
let(:subdomain){make_domain(:name => "sub.#{domain.name}", :user => user)} |
||||
let(:subsubdomain){make_domain(:name => "sub.#{subdomain.name}", :user => user)} |
||||
|
||||
# third user's domains |
||||
let(:domain3){make_domain(:user => user3)} |
||||
let(:subdomain3){make_domain(:name => "sub.#{domain.name}", :user => user3)} |
||||
let(:subsubdomain3){make_domain(:name => "sub.#{subdomain.name}", :user => user3)} |
||||
|
||||
let(:host_domain){ |
||||
domain = build(:domain, :user => admin, :name => Settings.host_domains.first) |
||||
domain.setup(FactoryGirl.generate(:email)) |
||||
domain.save! |
||||
domain.soa_record.update_serial! |
||||
domain |
||||
} |
||||
let(:host_a_record){create(:a, :content => '127.0.0.1', :domain => host_domain, :user => user)} |
||||
# admin's host domain (like entrydns.org) |
||||
let(:host_domain){make_domain(:user => admin, :name => Settings.host_domains.first)} |
||||
|
||||
let(:a_record){create(:a, :content => '127.0.0.1', :domain => domain)} |
||||
let(:soa_record){domain.soa_record} |
||||
let(:host_a_record){create(:a, :content => '127.0.0.1', :domain => host_domain, :user => user)} |
||||
|
||||
let(:permission){create(:permission, :domain => domain, :user => user2)} |
||||
let(:permission3){create(:permission, :domain => domain3, :user => user)} |
||||
|
||||
end |
||||
|
@ -0,0 +1,40 @@
|
||||
shared_examples_for "wiring controller" do |
||||
context "wiring" do |
||||
include_context "data" |
||||
let(:record){Record.new} |
||||
|
||||
context "on owned domain" do |
||||
before do |
||||
sign_in user |
||||
@controller.stub(:nested_parent_record => domain) |
||||
end |
||||
|
||||
it "#new_model is wired" do |
||||
@controller.send(:new_model).user.should == domain.user |
||||
end |
||||
|
||||
it "#before_create_save wires" do |
||||
@controller.send(:before_create_save, record) |
||||
record.user.should == domain.user |
||||
end |
||||
end |
||||
|
||||
context "on permitted domain" do |
||||
before do |
||||
sign_in user2 |
||||
permission # touch to ensure creation |
||||
@controller.stub(:nested_parent_record => domain) |
||||
end |
||||
|
||||
it "#new_model is wired" do |
||||
@controller.send(:new_model).user.should == domain.user |
||||
end |
||||
|
||||
it "#before_create_save wires" do |
||||
@controller.send(:before_create_save, record) |
||||
record.user.should == domain.user |
||||
end |
||||
end |
||||
|
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "aaaas/edit.html.erb" do |
||||
before(:each) do |
||||
@aaaa = assign(:aaaa, stub_model(Aaaa)) |
||||
end |
||||
|
||||
it "renders the edit aaaa form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => aaaas_path(@aaaa), :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,14 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "aaaas/index.html.erb" do |
||||
before(:each) do |
||||
assign(:aaaas, [ |
||||
stub_model(Aaaa), |
||||
stub_model(Aaaa) |
||||
]) |
||||
end |
||||
|
||||
it "renders a list of aaaas" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "aaaas/new.html.erb" do |
||||
before(:each) do |
||||
assign(:aaaa, stub_model(Aaaa).as_new_record) |
||||
end |
||||
|
||||
it "renders new aaaa form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => aaaas_path, :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "aaaas/show.html.erb" do |
||||
before(:each) do |
||||
@aaaa = assign(:aaaa, stub_model(Aaaa)) |
||||
end |
||||
|
||||
it "renders attributes in <p>" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "as/edit.html.erb" do |
||||
before(:each) do |
||||
@a = assign(:a, stub_model(A)) |
||||
end |
||||
|
||||
it "renders the edit a form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => as_path(@a), :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,14 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "as/index.html.erb" do |
||||
before(:each) do |
||||
assign(:as, [ |
||||
stub_model(A), |
||||
stub_model(A) |
||||
]) |
||||
end |
||||
|
||||
it "renders a list of as" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "as/new.html.erb" do |
||||
before(:each) do |
||||
assign(:a, stub_model(A).as_new_record) |
||||
end |
||||
|
||||
it "renders new a form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => as_path, :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "as/show.html.erb" do |
||||
before(:each) do |
||||
@a = assign(:a, stub_model(A)) |
||||
end |
||||
|
||||
it "renders attributes in <p>" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "cnames/edit.html.erb" do |
||||
before(:each) do |
||||
@cname = assign(:cname, stub_model(Cname)) |
||||
end |
||||
|
||||
it "renders the edit cname form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => cnames_path(@cname), :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,14 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "cnames/index.html.erb" do |
||||
before(:each) do |
||||
assign(:cnames, [ |
||||
stub_model(Cname), |
||||
stub_model(Cname) |
||||
]) |
||||
end |
||||
|
||||
it "renders a list of cnames" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "cnames/new.html.erb" do |
||||
before(:each) do |
||||
assign(:cname, stub_model(Cname).as_new_record) |
||||
end |
||||
|
||||
it "renders new cname form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => cnames_path, :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "cnames/show.html.erb" do |
||||
before(:each) do |
||||
@cname = assign(:cname, stub_model(Cname)) |
||||
end |
||||
|
||||
it "renders attributes in <p>" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "domains/edit.html.erb" do |
||||
before(:each) do |
||||
@domain = assign(:domain, stub_model(Domain)) |
||||
end |
||||
|
||||
it "renders the edit domain form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => domains_path(@domain), :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,14 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "domains/index.html.erb" do |
||||
before(:each) do |
||||
assign(:domains, [ |
||||
stub_model(Domain), |
||||
stub_model(Domain) |
||||
]) |
||||
end |
||||
|
||||
it "renders a list of domains" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "domains/new.html.erb" do |
||||
before(:each) do |
||||
assign(:domain, stub_model(Domain).as_new_record) |
||||
end |
||||
|
||||
it "renders new domain form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => domains_path, :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "domains/show.html.erb" do |
||||
before(:each) do |
||||
@domain = assign(:domain, stub_model(Domain)) |
||||
end |
||||
|
||||
it "renders attributes in <p>" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "hosts/edit.html.erb" do |
||||
before(:each) do |
||||
@host = assign(:host, stub_model(Host)) |
||||
end |
||||
|
||||
it "renders the edit host form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => hosts_path(@host), :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,14 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "hosts/index.html.erb" do |
||||
before(:each) do |
||||
assign(:hosts, [ |
||||
stub_model(Host), |
||||
stub_model(Host) |
||||
]) |
||||
end |
||||
|
||||
it "renders a list of hosts" do |
||||
render |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "hosts/new.html.erb" do |
||||
before(:each) do |
||||
assign(:host, stub_model(Host).as_new_record) |
||||
end |
||||
|
||||
it "renders new host form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => hosts_path, :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -1,11 +0,0 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "hosts/show.html.erb" do |
||||
before(:each) do |
||||
@host = assign(:host, stub_model(Host)) |
||||
end |
||||
|
||||
it "renders attributes in <p>" do |
||||
render |
||||
end |
||||
end |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue