Skip to content

Commit

Permalink
Moving paperclip presence tests from integration to base_spec.rb.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Morgenstern committed Oct 27, 2012
1 parent 147a20d commit 0db4fe2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
9 changes: 0 additions & 9 deletions spec/integration/basic/edit/rails_admin_basic_edit_spec.rb
Expand Up @@ -106,13 +106,4 @@
page.current_url.should == 'http://www.example.com/admin/ball?sort=color'
end
end

describe "image edit" do
it "should show required for paperclip attached file with validates_attachment_presence" do
@image = FactoryGirl.create :image
visit edit_path(:model_name => "image", :id => @image.id)

should have_selector("div", :text => /Required./)
end
end
end
8 changes: 0 additions & 8 deletions spec/integration/basic/new/rails_admin_basic_new_spec.rb
Expand Up @@ -70,12 +70,4 @@
page.should have_css("select#team_player_ids option[selected='selected'][value='#{@player.id}']")
end
end

describe "GET /admin/image/new" do
it "should show required for paperclip attached file with validates_attachment_presence" do
visit new_path(:model_name => "image")

should have_selector("div", :text => /File\s*Required/)
end
end
end
6 changes: 6 additions & 0 deletions spec/unit/config/fields/base_spec.rb
Expand Up @@ -11,6 +11,12 @@
RailsAdmin.config('Ball').fields.first.with(:object => Ball.new).should be_required
RailsAdmin.config('Ball').fields.first.with(:object => FactoryGirl.create(:ball)).should_not be_required
end

context 'on a Paperclip installation' do
it "should detect required fields" do
RailsAdmin.config('Image').fields.find{ |f| f.name == :file }.with(:object => Image.new).should be_required
end
end
end

describe "#name" do
Expand Down

0 comments on commit 0db4fe2

Please sign in to comment.