Skip to content

Commit

Permalink
added additional integration tests. upto 68 tests working well with a…
Browse files Browse the repository at this point in the history
…pp fixes along the way
  • Loading branch information
zeknox committed Dec 10, 2014
1 parent 6a61229 commit fedc420
Show file tree
Hide file tree
Showing 35 changed files with 776 additions and 184 deletions.
11 changes: 3 additions & 8 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,13 @@ guard :rspec, cmd: "bundle exec rspec" do

watch(rails.app) { |m| rspec.spec.(m[1]) }
watch(rails.views_n_layouts) { |m| rspec.spec.("#{m[1]}#{m[2]}") }
watch(rails.controllers) do |m|
[
rspec.spec.("routing/#{m[1]}_routing"),
rspec.spec.("controllers/#{m[1]}_controller"),
rspec.spec.("acceptance/#{m[1]}")
]
end

watch(rails.spec_support) { rspec.spec_dir }
watch(rails.factories) { rspec.spec_dir }
watch(rails.spec_helper) { rspec.spec_dir }
watch(rails.routes) { "spec/routing" }
watch(rails.routes) { rspec.spec_dir }
watch(rails.controllers) { rspec.spec_dir }
watch(rails.views) { rspec.spec_dir }
watch(rails.app_controller) { "spec/controllers" }

# Capybara features specs
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def index

def list
if params[:approved] == "false"
@admins = Admin.find_all_by_approved(false)
@admins = Admin.where(approved: false)
else
@admins = Admin.all
end
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ class ApplicationController < ActionController::Base
before_filter :authenticate_admin!
before_filter :system_status

add_flash_types :warning

protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username) }
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :name, :email, :password, :password_confirmation) }
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :name, :email, :password, :password_confirmation, :current_password) }
end

def system_status
Expand Down
8 changes: 1 addition & 7 deletions app/controllers/campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ def new
def create
@campaign = Campaign.new(params[:campaign])
if @campaign.save
@campaign_settings = CampaignSettings.new(:campaign_id => @campaign.id, :fqdn => '')
@email_settings = EmailSettings.new(:campaign_id => @campaign.id)
if @campaign_settings.save and @email_settings.save
redirect_to @campaign, notice: "Campaign Created"
else
render('new')
end
redirect_to @campaign, notice: "Campaign Created"
else
render('new')
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/clones_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def destroy
@clone.destroy

respond_to do |format|
format.html { redirect_to clones_url, notice: 'Website Deleted' }
format.html { redirect_to clones_url, warning: 'Website Deleted' }
format.json { head :no_content }
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/campaign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def create_deps
newSSL.function = function[0]
newSSL.save(validate: false)
end

# create campaign settings and email settings for campaign
CampaignSettings.create(campaign_id: id, fqdn: '')
EmailSettings.create(campaign_id: id)
end

def clicks
Expand Down
2 changes: 1 addition & 1 deletion app/models/victim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Victim < ActiveRecord::Base
belongs_to :campaign
has_many :visits, dependent: :destroy

validates_format_of :email_address, :with => /\A[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\z/i
validates_format_of :email_address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
before_create :default_values

attr_accessible :email_address, :uid, :campaign_id, :firstname, :lastname
Expand Down
1 change: 0 additions & 1 deletion app/views/access/menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
<div class='col-md-4 col-sm-4 center'>
<%= image_tag('fish.jpg', :size => '300x300') %>
</div>

1 change: 0 additions & 1 deletion app/views/campaigns/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@

<%= render partial: 'blasts', locals: { campaign: @campaign } %>
</div>

2 changes: 1 addition & 1 deletion app/views/campaigns/victims.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<td><%= victim.uid %></td>
<td><%= victim.sent %></td>
<td>
<%= link_to(image_tag('red_x.png', :size => '35x35'), {:controller => 'campaigns', :action => 'delete_victim', :id => victim.id, :method => 'delete', :remote => true}) %>
<%= link_to(image_tag('red_x.png', :size => '35x35'), {:controller => 'campaigns', :action => 'delete_victim', :id => victim.id, :method => 'delete', :remote => true}, id: "delete") %>
</td>
</tr>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/templates/list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
class: 'btn btn-default btn-xs', rel: 'tooltip', title: 'Show Template') %>
<%= link_to("<span class='glyphicon glyphicon-retweet'></span>".html_safe,
{:action => 'copy', :id => template.id}, data: {placement: 'bottom'},
class: 'btn btn-default btn-xs', rel: 'tooltip', title: 'Copy Template') %>
class: 'btn btn-default btn-xs', rel: 'tooltip', title: 'Copy Template', id: 'copy') %>
<%= link_to("<span class='glyphicon glyphicon-download-alt'></span>".html_safe,
{:action => 'backup', :id => template.id}, data: {placement: 'bottom'},
class: 'btn btn-default btn-xs', rel: 'tooltip', title: 'Backup Template') %>
<%= link_to "<span class='glyphicon glyphicon-remove'></span>".html_safe,
template_path(template), method: :delete,
class: 'btn btn-danger btn-xs', rel: 'tooltip',
class: 'btn btn-danger btn-xs', rel: 'tooltip', id: 'delete',
data: {confirm: 'Are you sure you want to permanently delete this campaign?', placement: 'bottom'}, title: 'Delete Template' %>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/tools/_harvester.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
['850', 850], ['900', 900],
['950', 950], ['1000', 1000]]
), class: 'form-control') %><br>
<%= submit_tag "Enumerate", class: 'btn btn-primary' %>
<%= submit_tag "Enumerate Emails", class: 'btn btn-primary' %>
<% end %>
</div>
<div class="modal-footer">
Expand Down
15 changes: 8 additions & 7 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

devise_for :admins


# image tracking routes.
get '/reports/image/:uid.png' => 'reports#image'

Expand Down Expand Up @@ -82,14 +83,14 @@
end
end

resources :clones do
member do
get 'download'
get 'preview'
end
end
resources :clones do
member do
get 'download'
get 'preview'
end
end

resources :tools
resources :tools

root :to => 'campaigns#home'

Expand Down
Loading

0 comments on commit fedc420

Please sign in to comment.