Skip to content

Commit

Permalink
fixed and stripped a bunch of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Muehlethaler committed Jan 2, 2012
1 parent 09e5e90 commit 3558954
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 60 deletions.
14 changes: 0 additions & 14 deletions app/views/beds/index.html.haml

This file was deleted.

2 changes: 1 addition & 1 deletion spec/controllers/gardens_controller_spec.rb
Expand Up @@ -22,7 +22,7 @@ def valid_attributes
before :each do
@account = double "account"
@account.stub(:id){1}
@controller.stub(:current_account) { puts "hallo!"; @account }
@controller.stub(:current_account) {@account }

end

Expand Down
11 changes: 6 additions & 5 deletions spec/requests/beds_spec.rb
@@ -1,14 +1,15 @@
require "spec_helper"

describe "BedsController" do
fixtures :gardens, :beds
describe "get /gardens/1/beds" do
it "works! (now write some real specs)" do
@account = FactoryGirl.create(:account)
@garden = FactoryGirl.create(:garden, account_id: @account.id)
@bed = FactoryGirl.create(:bed, garden_id: @garden.id)
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
BedsController.any_instance.stubs(:logged_in?).returns(true)
BedsController.any_instance.stubs(:current_account).returns(Account.new)
Account.any_instance.stubs(:username).returns("Hannes")
get(garden_bed_path(:garden_id => 1, :id => 1))
BedsController.any_instance.stub(:logged_in?){true}
BedsController.any_instance.stub(:current_account){@account}
get(garden_bed_path(:garden_id => @garden.id, :id => @bed.id))
response.status.should be(200)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/plants_spec.rb
Expand Up @@ -5,7 +5,7 @@
it "plants_path returns ok" do
get plants_path
response.status.should be(200)
response.body.should contain "Pflanzen"
response.body.should include "Pflanzen"
end
end
end
12 changes: 8 additions & 4 deletions spec/requests/tasks_spec.rb
@@ -1,11 +1,15 @@
require 'spec_helper'

describe "Tasks" do
describe "GET /tasks" do
it "tasks_path returns ok" do
get garden_tasks_path
describe "GET garden/tasks" do
it "garden_tasks_path returns ok" do
@account = FactoryGirl.create(:account)
@garden = FactoryGirl.create(:garden)
TasksController.any_instance.stub(:logged_in?){true}
TasksController.any_instance.stub(:current_account){@account}
get garden_tasks_path(:garden_id => @garden.id)
response.status.should be(200)
response.body.should contain "tasks"
response.body.should include "tasks"
end
end
end
15 changes: 0 additions & 15 deletions spec/views/beds/edit.html.erb_spec.rb

This file was deleted.

14 changes: 0 additions & 14 deletions spec/views/beds/index.html.erb_spec.rb

This file was deleted.

6 changes: 3 additions & 3 deletions spec/views/beds/new.html.erb_spec.rb
Expand Up @@ -3,13 +3,13 @@
describe "beds/new.html.erb" do
before(:each) do
assign(:bed, stub_model(Bed).as_new_record)
assign(:garden, stub_model(Garden))
assign(:possible_states, ["A", "B"])
end

it "renders new bed form" do
render

# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => beds_path, :method => "post" do
assert_select "form", :action => garden_beds_path(:garden), :method => "post" do
end
end
end
1 change: 1 addition & 0 deletions spec/views/beds/show.html.erb_spec.rb
Expand Up @@ -3,6 +3,7 @@
describe "beds/show.html.erb" do
before(:each) do
@bed = assign(:bed, stub_model(Bed))
@bed = assign(:garden, stub_model(Garden))
end

it "renders attributes in <p>" do
Expand Down
6 changes: 4 additions & 2 deletions spec/views/families/edit.html.erb_spec.rb
Expand Up @@ -4,8 +4,10 @@
before(:each) do
@family = assign(:family, stub_model(Family,
:name => "MyString",
:energy => "MyString"
:energy => "Starkzehrer"
))
assign(:possible_states, ["A", "B"])
assign(:possible_energies, ["Starkzehrer", "Schwachzehrer"])
end

it "renders the edit family form" do
Expand All @@ -14,7 +16,7 @@
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => families_path(@family), :method => "post" do
assert_select "input#family_name", :name => "family[name]"
assert_select "input#family_energy", :name => "family[energy]"
assert_select "select#family_energy", :name => "family[energy]"
end
end
end
5 changes: 4 additions & 1 deletion spec/views/families/new.html.erb_spec.rb
Expand Up @@ -6,6 +6,9 @@
:name => "MyString",
:energy => "MyString"
).as_new_record)

assign(:possible_energies, ["Starkzehrer", "Schwachzehrer"])
assign(:possible_states, ["A", "B"])
end

it "renders new family form" do
Expand All @@ -14,7 +17,7 @@
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => families_path, :method => "post" do
assert_select "input#family_name", :name => "family[name]"
assert_select "input#family_energy", :name => "family[energy]"
assert_select "select#family_energy", :name => "family[energy]"
end
end
end
1 change: 1 addition & 0 deletions spec/views/plants/edit.html.erb_spec.rb
Expand Up @@ -5,6 +5,7 @@
@plant = assign(:plant, stub_model(Plant,
:name => "MyString"
))
assign(:families, [stub_model(Family)])
end

it "renders the edit plant form" do
Expand Down
1 change: 1 addition & 0 deletions spec/views/plants/new.html.erb_spec.rb
Expand Up @@ -5,6 +5,7 @@
assign(:plant, stub_model(Plant,
:name => "MyString"
).as_new_record)
assign(:families, [stub_model(Family)])
end

it "renders new plant form" do
Expand Down

0 comments on commit 3558954

Please sign in to comment.