Remove tests for strong parameters
Remove a duplicated test.
This commit is contained in:
parent
938de466f8
commit
a0a9f01be1
1 changed files with 1 additions and 57 deletions
|
|
@ -41,36 +41,12 @@ describe AspectsController do
|
|||
response.should be_redirect
|
||||
end
|
||||
it 'redirects on an invalid id' do
|
||||
get :show, 'id' => 4341029835
|
||||
get :show, 'id' => 4341029834
|
||||
response.should be_redirect
|
||||
end
|
||||
end
|
||||
|
||||
describe "#create" do
|
||||
context "strong parameters" do
|
||||
it "permits 'name', 'contacts_visible' and 'order_id'" do
|
||||
post :create, "aspect" => {
|
||||
"name" => "new aspect",
|
||||
"contacts_visible" => true,
|
||||
"order_id" => 1
|
||||
}
|
||||
aspect = alice.aspects.last
|
||||
aspect.name.should eq("new aspect")
|
||||
aspect.contacts_visible.should eq(true)
|
||||
aspect.order_id.should eq(1)
|
||||
end
|
||||
|
||||
it "forbids other params" do
|
||||
post :create, "aspect" => {
|
||||
"name" => "new aspect",
|
||||
"user_id" => 123
|
||||
}
|
||||
aspect = Aspect.last
|
||||
aspect.name.should eq("new aspect")
|
||||
aspect.user_id.should_not eq(123)
|
||||
end
|
||||
end
|
||||
|
||||
context "with valid params" do
|
||||
it "creates an aspect" do
|
||||
alice.aspects.count.should == 2
|
||||
|
|
@ -121,38 +97,6 @@ describe AspectsController do
|
|||
@alices_aspect_1 = alice.aspects.create(:name => "Bruisers")
|
||||
end
|
||||
|
||||
context "strong parameters" do
|
||||
it "permits 'name', 'contacts_visible' and 'order_id'" do
|
||||
put 'update', :id => @alices_aspect_1.id, "aspect" => {
|
||||
"name" => "new aspect",
|
||||
"contacts_visible" => true,
|
||||
"order_id" => 1
|
||||
}
|
||||
aspect = Aspect.find(@alices_aspect_1.id)
|
||||
aspect.name.should eq("new aspect")
|
||||
aspect.contacts_visible.should eq(true)
|
||||
aspect.order_id.should eq(1)
|
||||
end
|
||||
|
||||
it "forbids other params" do
|
||||
put :update, :id => @alices_aspect_1.id, "aspect" => {
|
||||
"name" => "new aspect",
|
||||
"user_id" => 123
|
||||
}
|
||||
aspect = Aspect.find(@alices_aspect_1.id)
|
||||
aspect.name.should eq("new aspect")
|
||||
aspect.user_id.should_not eq(123)
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't overwrite random attributes" do
|
||||
new_user = FactoryGirl.create :user
|
||||
params = {"name" => "Bruisers"}
|
||||
params[:user_id] = new_user.id
|
||||
put('update', :id => @alices_aspect_1.id, "aspect" => params)
|
||||
Aspect.find(@alices_aspect_1.id).user_id.should == alice.id
|
||||
end
|
||||
|
||||
it "should return the name and id of the updated item" do
|
||||
params = {"name" => "Bruisers"}
|
||||
put('update', :id => @alices_aspect_1.id, "aspect" => params)
|
||||
|
|
|
|||
Loading…
Reference in a new issue