Permalink
Browse files

fixes default specs

  • Loading branch information...
1 parent 3c41edf commit d463e4868ac318892e1acef45b6a37f87fbbd4a8 @Crunch09 committed Mar 26, 2013
@@ -54,7 +54,7 @@
<%= hidden_field_tag 'report[person_ids][]' %>
<div class='field'>
- <% Usable.all['intern'].each do |department, usables| %>
+ <% Usable.all.fetch('intern', []).each do |department, usables| %>
<p>
<h3><%= department %></h3>
<% usables.each do |usable| %>
@@ -66,7 +66,7 @@
</div>
<div class='field'>
- <% Usable.all['extern'].each do |department, usables| %>
+ <% Usable.all.fetch('extern', []).each do |department, usables| %>
<p>
<h3><%= department %></h3>
<% usables.each do |usable| %>
@@ -7,6 +7,7 @@ def self.all
combined = Refinery::Reports::Vehicle.all + Refinery::Reports::Person.all
hsh = combined.group_by{|u| u.department.intern? ? 'intern' : 'extern'}
@usables = hsh.each{|k,v| hsh[k] = v.group_by{|r| r.department.name}}
+ @usables = [] if @usables.nil?
@usables
end
end
@@ -30,9 +30,11 @@
context "valid data" do
it "should succeed" do
fill_in "Keyword", :with => "This is a test of the first string field"
+ fill_in "Location", :with => "Boston"
+ fill_in "Chief", :with => "Peter Parker"
click_button "Save"
- page.should have_content("'This is a test of the first string field' was successfully added.")
+ page.should have_content("Report was created")
Refinery::Reports::Report.count.should == 1
end
end
@@ -77,7 +79,7 @@
fill_in "Keyword", :with => "A different keyword"
click_button "Save"
- page.should have_content("'A different keyword' was successfully updated.")
+ page.should have_content("Report was updated")
page.should have_no_content("A keyword")
end
end
@@ -2,6 +2,9 @@
FactoryGirl.define do
factory :report, :class => Refinery::Reports::Report do
sequence(:keyword) { |n| "refinery#{n}" }
+ location 'Boston'
+ started_at '2013-03-23 10:00:00'
+ chief 'Peter Parker'
end
end

0 comments on commit d463e48

Please sign in to comment.