File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,5 +2,4 @@ class Note < ActiveRecord::Base
22 belongs_to :petition , touch : true
33
44 validates :petition , presence : true
5- validates :details , presence : true
65end
Original file line number Diff line number Diff line change @@ -32,3 +32,19 @@ Feature: A moderator user updates records notes
3232 Then I should be on the admin petition page for "Solidarity with the Unions"
3333 And I follow "Notes"
3434 Then I should see "I think we can debate this, will check with unions select committee first"
35+
36+ Scenario : Removing notes
37+ Given an open petition exists with action: "Solidarity with the Unions"
38+ When I am on the admin all petitions page
39+ And I follow "Solidarity with the Unions"
40+ And I follow "Notes"
41+ Then I should see a "Notes" textarea field
42+ And the markup should be valid
43+ When I fill in "Notes" with "I think we can debate this, will check with unions select committee first"
44+ And I press "Save"
45+ Then I should be on the admin petition page for "Solidarity with the Unions"
46+ And I follow "Notes"
47+ Then I should see "I think we can debate this, will check with unions select committee first"
48+ When I fill in "Notes" with ""
49+ And I press "Save"
50+ Then I should be on the admin petition page for "Solidarity with the Unions"
Original file line number Diff line number Diff line change @@ -117,26 +117,6 @@ def do_patch(overrides = {})
117117 expect ( petition . note . details ) . to eq notes_attributes [ :details ]
118118 end
119119 end
120-
121- describe 'with invalid params' do
122- it 're-renders the notes/show template' do
123- do_patch ( note : { details : "" } )
124- expect ( response ) . to be_success
125- expect ( response ) . to render_template ( 'petitions/show' )
126- end
127-
128- it 'leaves the in-memory instance with errors' do
129- do_patch ( note : { details : "" } )
130- expect ( assigns ( :note ) ) . to be_present
131- expect ( assigns ( :note ) . errors ) . not_to be_empty
132- end
133-
134- it 'does not stores the supplied notes in the db' do
135- do_patch ( note : { details : "" } )
136- petition . reload
137- expect ( petition . note ) . to be_nil
138- end
139- end
140120 end
141121
142122 describe 'for an open petition' do
Original file line number Diff line number Diff line change 1717 subject { FactoryGirl . build ( :note ) }
1818
1919 it { is_expected . to validate_presence_of ( :petition ) }
20- it { is_expected . to validate_presence_of ( :details ) }
20+ it { is_expected . not_to validate_presence_of ( :details ) }
2121 end
2222end
You can’t perform that action at this time.
0 commit comments