After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 454 B |
After Width: | Height: | Size: 604 B |
After Width: | Height: | Size: 404 B |
@ -0,0 +1,438 @@
|
||||
body { |
||||
color: #111111; |
||||
background: #c4c4c4 url("images/bgd.jpg"); |
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; |
||||
} |
||||
|
||||
h1, h2, h3 { |
||||
color: #111111; |
||||
font-weight: normal; |
||||
font-family: Cambria, Georgia, serif; |
||||
} |
||||
|
||||
a:link, a:visited, a:hover, a:active { |
||||
color: #111111; |
||||
} |
||||
|
||||
a { |
||||
-moz-outline: none; |
||||
} |
||||
|
||||
hr { |
||||
background: #dddddd; |
||||
color: #dddddd; |
||||
} |
||||
|
||||
#header { |
||||
height: 80px; |
||||
background-color: #333333; |
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); |
||||
box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(255, 255, 255, 0.3); |
||||
-moz-box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(255, 255, 255, 0.3); |
||||
-webkit-box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(255, 255, 255, 0.3); |
||||
} |
||||
#header h1 { |
||||
padding: 15px 5px; |
||||
float: left; |
||||
font-size: 40px; |
||||
font-style: normal; |
||||
text-transform: normal; |
||||
letter-spacing: -1px; |
||||
line-height: 1.2em; |
||||
color: white; |
||||
} |
||||
#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { |
||||
color: white; |
||||
} |
||||
|
||||
#main { |
||||
width: 77%; |
||||
float: left; |
||||
} |
||||
#main .block { |
||||
padding-top: 0px; |
||||
background-color: white; |
||||
text-shadow: 0 1px 0 white; |
||||
-moz-border-radius: 6px; |
||||
-webkit-border-radius: 6px; |
||||
border-radius: 6px; |
||||
box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.3); |
||||
-moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.3); |
||||
-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.3); |
||||
} |
||||
#main .block .content { |
||||
padding-top: 1px; |
||||
} |
||||
#main .block .content .inner { |
||||
padding: 0 15px 15px; |
||||
} |
||||
#main .block .content h2 { |
||||
margin-left: 15px; |
||||
font-size: 22px; |
||||
text-transform: normal; |
||||
letter-spacing: -1px; |
||||
line-height: 1.2em; |
||||
} |
||||
#main .block .content p { |
||||
font-size: 13px; |
||||
font-style: normal; |
||||
font-weight: normal; |
||||
text-transform: normal; |
||||
letter-spacing: normal; |
||||
line-height: 1.45em; |
||||
} |
||||
|
||||
#main-navigation { |
||||
padding-top: 30px; |
||||
width: auto; |
||||
} |
||||
#main-navigation ul li { |
||||
padding-left: 20px; |
||||
margin-right: 0; |
||||
} |
||||
#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active { |
||||
padding: 8px 0; |
||||
text-decoration: none; |
||||
color: #eeeeee; |
||||
} |
||||
#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { |
||||
color: #a4a4a4; |
||||
} |
||||
|
||||
.secondary-navigation { |
||||
background: #e0e0e0 url("images/boxbar-background.png") top; |
||||
border-bottom-width: 0px; |
||||
-moz-border-radius-topleft: 6px; |
||||
-webkit-border-top-left-radius: 6px; |
||||
border-top-left-radius: 6px; |
||||
-moz-border-radius-topright: 6px; |
||||
-webkit-border-top-right-radius: 6px; |
||||
border-top-right-radius: 6px; |
||||
} |
||||
.secondary-navigation li.first a, .secondary-navigation ul li.first { |
||||
-moz-border-radius-topleft: 6px; |
||||
-webkit-border-top-left-radius: 6px; |
||||
border-top-left-radius: 6px; |
||||
} |
||||
.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active { |
||||
text-decoration: none; |
||||
color: #111111; |
||||
} |
||||
.secondary-navigation ul li.text { |
||||
padding: 10px 15px; |
||||
color: #818171; |
||||
} |
||||
.secondary-navigation ul li.active { |
||||
background-color: white; |
||||
} |
||||
.secondary-navigation ul li.active a:hover { |
||||
background-color: white; |
||||
} |
||||
|
||||
#user-navigation { |
||||
top: 33px; |
||||
right: 10px; |
||||
color: #eeeeee; |
||||
font-size: 14px; |
||||
} |
||||
|
||||
#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { |
||||
text-decoration: none; |
||||
color: #eeeeee; |
||||
} |
||||
#user-navigation ul li a:active img { |
||||
margin-top: 1px; |
||||
} |
||||
|
||||
#user-navigation ul li, .secondary-navigation ul li { |
||||
float: left; |
||||
} |
||||
|
||||
#footer { |
||||
color: #261f1f; |
||||
text-shadow: none; |
||||
} |
||||
#footer .block { |
||||
-webkit-box-shadow: none; |
||||
-moz-box-shadow: none; |
||||
box-shadow: none; |
||||
background: none; |
||||
} |
||||
#footer p { |
||||
margin: 0; |
||||
padding: 0; |
||||
text-align: center; |
||||
} |
||||
|
||||
#sidebar { |
||||
width: 20%; |
||||
float: right; |
||||
} |
||||
#sidebar .block { |
||||
padding-top: 2px; |
||||
padding-bottom: 2px; |
||||
-moz-border-radius: 6px; |
||||
-webkit-border-radius: 6px; |
||||
border-radius: 6px; |
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); |
||||
} |
||||
#sidebar .block h4 { |
||||
font-weight: normal; |
||||
font-family: helvetica, arial, sans-serif; |
||||
} |
||||
#sidebar .notice { |
||||
color: white; |
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); |
||||
background-color: rgba(0, 0, 0, 0.3); |
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(0, 0, 0, 0.15)), to(rgba(0, 0, 0, 0))); |
||||
background-image: -moz-linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0)); |
||||
-moz-border-radius: 6px; |
||||
-webkit-border-radius: 6px; |
||||
border-radius: 6px; |
||||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(255, 255, 255, 0.3); |
||||
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(255, 255, 255, 0.3); |
||||
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(255, 255, 255, 0.3); |
||||
} |
||||
#sidebar .warning { |
||||
padding-left: 10px; |
||||
padding-right: 10px; |
||||
color: #222222; |
||||
background: #ffef4e; |
||||
-moz-border-radius: 6px; |
||||
-webkit-border-radius: 6px; |
||||
border-radius: 6px; |
||||
box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.1); |
||||
-moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.1); |
||||
-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.1); |
||||
border: 1px solid rgba(0, 0, 0, 0.3); |
||||
} |
||||
#sidebar h3 { |
||||
padding-left: 25px; |
||||
color: #111111; |
||||
border-bottom: 1px solid #261f1f; |
||||
} |
||||
#sidebar ul li { |
||||
background-position: 0 11px; |
||||
background-repeat: no-repeat; |
||||
background-image: url("images/arrow.png"); |
||||
border-bottom: 1px dashed #777777; |
||||
list-style-type: none; |
||||
} |
||||
#sidebar ul li a { |
||||
margin-left: 10px; |
||||
text-decoration: none; |
||||
text-shadow: 0 1px 0 white; |
||||
} |
||||
#sidebar ul li.active a { |
||||
color: #a4a4a4; |
||||
} |
||||
|
||||
.control { |
||||
float: right; |
||||
margin-right: 9px; |
||||
margin-top: 11px; |
||||
} |
||||
|
||||
.pagination a, .pagination span { |
||||
border: 1px solid #c3c4ba; |
||||
-moz-border-radius: 2px; |
||||
-webkit-border-radius: 2px; |
||||
border-radius: 2px; |
||||
margin-right: 5px; |
||||
padding: 6px; |
||||
min-width: 15px; |
||||
text-align: center; |
||||
background: #dddddd; |
||||
background-image: url("images/button-background.png"); |
||||
color: #111111; |
||||
} |
||||
.pagination a:hover { |
||||
border: 1px solid #818171; |
||||
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); |
||||
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); |
||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); |
||||
} |
||||
.pagination span.current { |
||||
background: #261f1f; |
||||
color: white; |
||||
border: 1px solid #261f1f; |
||||
} |
||||
|
||||
.pagination a:active { |
||||
background-image: url("images/button-background-active.png"); |
||||
outline: none; |
||||
} |
||||
|
||||
.table th { |
||||
background: #eaeaea; |
||||
color: #222222; |
||||
font-weight: normal; |
||||
} |
||||
.table th.last { |
||||
min-width: 90px; |
||||
} |
||||
.table td { |
||||
border-bottom: 1px solid #eaeaea; |
||||
} |
||||
.table td.last { |
||||
padding-top: 0px; |
||||
padding-bottom: 0px; |
||||
} |
||||
.table tr.even { |
||||
background: #f8f8f8; |
||||
} |
||||
|
||||
.form label.label { |
||||
font-family: helvetica, arial, sans-serif; |
||||
font-weight: normal; |
||||
color: #666666; |
||||
} |
||||
.form input.text_field, .form textarea.text_area { |
||||
width: 100%; |
||||
border: 1px solid #dddddd; |
||||
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); |
||||
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); |
||||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); |
||||
} |
||||
.form input.button { |
||||
background: #dddddd; |
||||
-moz-border-radius: 5px; |
||||
-webkit-border-radius: 5px; |
||||
border-radius: 5px; |
||||
border: 1px solid #c1c1c1; |
||||
padding: 2px 5px; |
||||
cursor: pointer; |
||||
color: #111111; |
||||
font-weight: bold; |
||||
font-size: 11px; |
||||
} |
||||
.form input.button:hover { |
||||
border: 1px solid #666666; |
||||
} |
||||
.form .description { |
||||
font-style: italic; |
||||
color: #8c8c8c; |
||||
font-size: 0.9em; |
||||
} |
||||
.form .navform a { |
||||
color: #cc0000; |
||||
} |
||||
|
||||
.flash .message { |
||||
-moz-border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
border-radius: 3px; |
||||
text-align: center; |
||||
margin: 0 auto 15px; |
||||
color: white; |
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); |
||||
} |
||||
.flash .message p { |
||||
margin: 8px; |
||||
} |
||||
.flash .error, .flash .error-list { |
||||
border: 1px solid #993624; |
||||
background: #cc4831 url("images/messages/error.png") no-repeat 10px center; |
||||
} |
||||
.flash .warning { |
||||
border: 1px solid #bb9004; |
||||
background: #f9c006 url("images/messages/warning.png") no-repeat 10px center; |
||||
} |
||||
.flash .notice { |
||||
color: #28485e; |
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); |
||||
border: 1px solid #8a9daa; |
||||
background: #b8d1e2 url("images/messages/notice.png") no-repeat 10px center; |
||||
} |
||||
.flash .error-list { |
||||
text-align: left; |
||||
} |
||||
.flash .error-list h2 { |
||||
font-size: 16px; |
||||
text-align: center; |
||||
} |
||||
.flash .error-list ul { |
||||
padding-left: 22px; |
||||
line-height: 18px; |
||||
list-style-type: square; |
||||
margin-bottom: 15px; |
||||
} |
||||
|
||||
ul.list li { |
||||
border-bottom-color: #dddddd; |
||||
border-bottom-width: 1px; |
||||
border-bottom-style: solid; |
||||
} |
||||
ul.list li .item .avatar { |
||||
border-color: #dddddd; |
||||
border-width: 1px; |
||||
border-style: solid; |
||||
padding: 2px; |
||||
} |
||||
|
||||
#box { |
||||
width: 480px; |
||||
} |
||||
#box .block { |
||||
background: white; |
||||
text-shadow: 0 1px 0 white; |
||||
box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.3); |
||||
-moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.3); |
||||
-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.3); |
||||
-moz-border-radius: 6px; |
||||
-webkit-border-radius: 6px; |
||||
border-radius: 6px; |
||||
} |
||||
#box .block h2 { |
||||
background: #261f1f; |
||||
color: white; |
||||
text-shadow: none; |
||||
-moz-border-radius-topleft: 6px; |
||||
-webkit-border-top-left-radius: 6px; |
||||
border-top-left-radius: 6px; |
||||
-moz-border-radius-topright: 6px; |
||||
-webkit-border-top-right-radius: 6px; |
||||
border-top-right-radius: 6px; |
||||
} |
||||
|
||||
a.button, button.button { |
||||
background: #edeeed url("images/button-background.png") top; |
||||
border: 1px solid #c3c4ba; |
||||
font-family: helvetica, arial, sans-serif; |
||||
font-weight: normal; |
||||
-moz-border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
border-radius: 3px; |
||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); |
||||
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); |
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); |
||||
} |
||||
a.button:link, a.button:visited, a.button:hover, a.button:active, button.button:link, button.button:visited, button.button:hover, button.button:active { |
||||
font-weight: normal; |
||||
background: #edeeed url("images/button-background.png") top; |
||||
} |
||||
|
||||
a.button:active, button.button:active { |
||||
background: #eaeaea url("images/button-background-active.png") top; |
||||
outline: none; |
||||
margin-top: 1px; |
||||
margin-bottom: -1px; |
||||
} |
||||
|
||||
.form div.left { |
||||
width: 10%; |
||||
float: left; |
||||
} |
||||
.form div.right { |
||||
width: 85%; |
||||
float: right; |
||||
} |
||||
|
||||
.login div.left, .signup div div.left { |
||||
width: 21%; |
||||
float: left; |
||||
} |
||||
.login div.right, .signup div div.right { |
||||
width: 74%; |
||||
float: right; |
||||
} |
@ -0,0 +1,43 @@
|
||||
class MxesController < ApplicationController |
||||
active_scaffold :mx do |conf| |
||||
conf.list.columns = [:name, :type, :content, :ttl, :prio, :change_date] |
||||
conf.create.columns = [:name, :content, :ttl, :prio] |
||||
conf.update.columns = [:name, :content, :ttl, :prio] |
||||
conf.columns[:content].label = 'MX' |
||||
conf.columns[:name].description = 'Ex: mail or mx etc' |
||||
conf.columns[:change_date].list_ui = :timestamp |
||||
conf.actions.exclude :show |
||||
end |
||||
before_filter :ensure_nested_under_domain |
||||
|
||||
protected |
||||
|
||||
def do_new |
||||
super |
||||
@record.prio ||= begin |
||||
maximum = nested_parent_record.mx_records.maximum(:prio) |
||||
maximum.nil? ? Settings.default_prio : maximum + 10 |
||||
end |
||||
end |
||||
|
||||
# override to use :mx_records instead of :records assoc |
||||
def beginning_of_chain |
||||
if nested? && nested.association && nested.association.collection? && nested.association.name == :records |
||||
nested.parent_scope.mx_records |
||||
else |
||||
super |
||||
end |
||||
end |
||||
|
||||
# override, we make our own sti logic |
||||
def new_model |
||||
model = beginning_of_chain |
||||
model.new |
||||
end |
||||
|
||||
# override to close create form after success |
||||
def render_parent? |
||||
nested_singular_association? # || params[:parent_sti] |
||||
end |
||||
|
||||
end |
@ -1,15 +1,11 @@
|
||||
class NsController < ApplicationController |
||||
active_scaffold :ns do |conf| |
||||
conf.columns = [:name, :content, :ttl] |
||||
conf.list.columns = [:name, :type, :content, :ttl, :prio, :change_date] |
||||
conf.create.columns = [:content, :ttl] |
||||
conf.update.columns = [:content, :ttl] |
||||
conf.columns[:content].label = 'NS' |
||||
conf.columns[:change_date].list_ui = :timestamp |
||||
conf.actions.exclude :show |
||||
end |
||||
|
||||
protected |
||||
|
||||
def beginning_of_chain |
||||
super.readonly(false) |
||||
end |
||||
before_filter :ensure_nested_under_domain |
||||
end |
||||
|
@ -1,18 +1,25 @@
|
||||
class RecordsController < ApplicationController |
||||
# override so SOA's cannot be created by themselves |
||||
def self._add_sti_create_links |
||||
new_action_link = active_scaffold_config.action_links.collection['new'] |
||||
unless new_action_link.nil? || active_scaffold_config.sti_children.empty? |
||||
active_scaffold_config.action_links.collection.delete('new') |
||||
sti_children = active_scaffold_config.sti_children - [:SOA] |
||||
sti_children.each do |child| |
||||
new_sti_link = Marshal.load(Marshal.dump(new_action_link)) # deep clone |
||||
new_sti_link.label = child.to_s.camelize.constantize.model_name.human |
||||
new_sti_link.parameters = {:parent_sti => controller_path} |
||||
new_sti_link.controller = Proc.new { active_scaffold_controller_for(child.to_s.camelize.constantize).controller_path } |
||||
active_scaffold_config.action_links.collection.create.add(new_sti_link) |
||||
end |
||||
end |
||||
end |
||||
|
||||
active_scaffold :record do |conf| |
||||
conf.sti_children = [:SOA, :NS] |
||||
conf.sti_children = [:SOA, :NS, :MX] |
||||
conf.columns = [:name, :type, :content, :ttl, :prio, :change_date] |
||||
conf.columns[:change_date].list_ui = :timestamp |
||||
conf.actions.exclude :show |
||||
end |
||||
before_filter :ensure_nested_under_domain |
||||
|
||||
protected |
||||
|
||||
def beginning_of_chain |
||||
super.readonly(false) |
||||
end |
||||
|
||||
def ensure_nested_under_domain |
||||
raise CanCan::AccessDenied, "not found" unless nested? and nested_parent_record.is_a?(Domain) |
||||
end |
||||
end |
||||
|
@ -1,14 +1,9 @@
|
||||
class SoasController < ApplicationController |
||||
active_scaffold :soa do |conf| |
||||
conf.columns = [:name, :primary_ns, :contact, :ttl] |
||||
conf.list.columns = [:name, :type, :content, :ttl, :prio, :change_date] |
||||
conf.create.columns = [:contact, :ttl] |
||||
conf.update.columns = [:contact, :ttl] |
||||
conf.columns[:change_date].list_ui = :timestamp |
||||
conf.actions.exclude :delete, :show |
||||
end |
||||
|
||||
protected |
||||
|
||||
def beginning_of_chain |
||||
super.readonly(false) |
||||
end |
||||
end |
||||
|
@ -1,13 +0,0 @@
|
||||
<% columns.each do |column| %> |
||||
<% authorized = record.authorized_for?(:crud_type => :read, :column => column.name) -%> |
||||
<% column_value = authorized ? get_column_value(record, column) : active_scaffold_config.list.empty_field_text -%> |
||||
|
||||
<td class="<%= column_class(column, column_value, record) %>" > |
||||
<% if column.name == :change_date %> |
||||
<% column_value = Time.at(record.change_date) unless record.change_date.nil? # TODO: localize ? %> |
||||
<%= authorized ? render_list_column(column_value, column, record) : column_value %> |
||||
<% else %> |
||||
<%= authorized ? render_list_column(column_value, column, record) : column_value %> |
||||
<% end %> |
||||
</td> |
||||
<% end -%> |
@ -0,0 +1,157 @@
|
||||
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 MxesController do |
||||
|
||||
# This should return the minimal set of attributes required to create a valid |
||||
# Mx. As you add validations to Mx, be sure to |
||||
# update the return value of this method accordingly. |
||||
def valid_attributes |
||||
{} |
||||
end |
||||
|
||||
describe "GET index" do |
||||
it "assigns all mxes as @mxes" do |
||||
mx = Mx.create! valid_attributes |
||||
get :index |
||||
assigns(:mxes).should eq([mx]) |
||||
end |
||||
end |
||||
|
||||
describe "GET show" do |
||||
it "assigns the requested mx as @mx" do |
||||
mx = Mx.create! valid_attributes |
||||
get :show, :id => mx.id.to_s |
||||
assigns(:mx).should eq(mx) |
||||
end |
||||
end |
||||
|
||||
describe "GET new" do |
||||
it "assigns a new mx as @mx" do |
||||
get :new |
||||
assigns(:mx).should be_a_new(Mx) |
||||
end |
||||
end |
||||
|
||||
describe "GET edit" do |
||||
it "assigns the requested mx as @mx" do |
||||
mx = Mx.create! valid_attributes |
||||
get :edit, :id => mx.id.to_s |
||||
assigns(:mx).should eq(mx) |
||||
end |
||||
end |
||||
|
||||
describe "POST create" do |
||||
describe "with valid params" do |
||||
it "creates a new Mx" do |
||||
expect { |
||||
post :create, :mx => valid_attributes |
||||
}.to change(Mx, :count).by(1) |
||||
end |
||||
|
||||
it "assigns a newly created mx as @mx" do |
||||
post :create, :mx => valid_attributes |
||||
assigns(:mx).should be_a(Mx) |
||||
assigns(:mx).should be_persisted |
||||
end |
||||
|
||||
it "redirects to the created mx" do |
||||
post :create, :mx => valid_attributes |
||||
response.should redirect_to(Mx.last) |
||||
end |
||||
end |
||||
|
||||
describe "with invalid params" do |
||||
it "assigns a newly created but unsaved mx as @mx" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Mx.any_instance.stub(:save).and_return(false) |
||||
post :create, :mx => {} |
||||
assigns(:mx).should be_a_new(Mx) |
||||
end |
||||
|
||||
it "re-renders the 'new' template" do |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Mx.any_instance.stub(:save).and_return(false) |
||||
post :create, :mx => {} |
||||
response.should render_template("new") |
||||
end |
||||
end |
||||
end |
||||
|
||||
describe "PUT update" do |
||||
describe "with valid params" do |
||||
it "updates the requested mx" do |
||||
mx = Mx.create! valid_attributes |
||||
# Assuming there are no other mxes in the database, this |
||||
# specifies that the Mx created on the previous line |
||||
# receives the :update_attributes message with whatever params are |
||||
# submitted in the request. |
||||
Mx.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) |
||||
put :update, :id => mx.id, :mx => {'these' => 'params'} |
||||
end |
||||
|
||||
it "assigns the requested mx as @mx" do |
||||
mx = Mx.create! valid_attributes |
||||
put :update, :id => mx.id, :mx => valid_attributes |
||||
assigns(:mx).should eq(mx) |
||||
end |
||||
|
||||
it "redirects to the mx" do |
||||
mx = Mx.create! valid_attributes |
||||
put :update, :id => mx.id, :mx => valid_attributes |
||||
response.should redirect_to(mx) |
||||
end |
||||
end |
||||
|
||||
describe "with invalid params" do |
||||
it "assigns the mx as @mx" do |
||||
mx = Mx.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Mx.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => mx.id.to_s, :mx => {} |
||||
assigns(:mx).should eq(mx) |
||||
end |
||||
|
||||
it "re-renders the 'edit' template" do |
||||
mx = Mx.create! valid_attributes |
||||
# Trigger the behavior that occurs when invalid params are submitted |
||||
Mx.any_instance.stub(:save).and_return(false) |
||||
put :update, :id => mx.id.to_s, :mx => {} |
||||
response.should render_template("edit") |
||||
end |
||||
end |
||||
end |
||||
|
||||
describe "DELETE destroy" do |
||||
it "destroys the requested mx" do |
||||
mx = Mx.create! valid_attributes |
||||
expect { |
||||
delete :destroy, :id => mx.id.to_s |
||||
}.to change(Mx, :count).by(-1) |
||||
end |
||||
|
||||
it "redirects to the mxes list" do |
||||
mx = Mx.create! valid_attributes |
||||
delete :destroy, :id => mx.id.to_s |
||||
response.should redirect_to(mxes_url) |
||||
end |
||||
end |
||||
|
||||
end |
@ -0,0 +1,15 @@
|
||||
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 |
@ -0,0 +1,11 @@
|
||||
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 |
@ -0,0 +1,35 @@
|
||||
require "spec_helper" |
||||
|
||||
describe MxesController do |
||||
describe "routing" do |
||||
|
||||
it "routes to #index" do |
||||
get("/mxes").should route_to("mxes#index") |
||||
end |
||||
|
||||
it "routes to #new" do |
||||
get("/mxes/new").should route_to("mxes#new") |
||||
end |
||||
|
||||
it "routes to #show" do |
||||
get("/mxes/1").should route_to("mxes#show", :id => "1") |
||||
end |
||||
|
||||
it "routes to #edit" do |
||||
get("/mxes/1/edit").should route_to("mxes#edit", :id => "1") |
||||
end |
||||
|
||||
it "routes to #create" do |
||||
post("/mxes").should route_to("mxes#create") |
||||
end |
||||
|
||||
it "routes to #update" do |
||||
put("/mxes/1").should route_to("mxes#update", :id => "1") |
||||
end |
||||
|
||||
it "routes to #destroy" do |
||||
delete("/mxes/1").should route_to("mxes#destroy", :id => "1") |
||||
end |
||||
|
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "mxes/edit.html.erb" do |
||||
before(:each) do |
||||
@mx = assign(:mx, stub_model(Mx)) |
||||
end |
||||
|
||||
it "renders the edit mx form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => mxes_path(@mx), :method => "post" do |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "mxes/index.html.erb" do |
||||
before(:each) do |
||||
assign(:mxes, [ |
||||
stub_model(Mx), |
||||
stub_model(Mx) |
||||
]) |
||||
end |
||||
|
||||
it "renders a list of mxes" do |
||||
render |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
require 'spec_helper' |
||||
|
||||
describe "mxes/new.html.erb" do |
||||
before(:each) do |
||||
assign(:mx, stub_model(Mx).as_new_record) |
||||
end |
||||
|
||||
it "renders new mx form" do |
||||
render |
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers |
||||
assert_select "form", :action => mxes_path, :method => "post" do |
||||
end |
||||
end |
||||
end |