Skip to content

Instantly share code, notes, and snippets.

@cjcolvar
Created August 21, 2013 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjcolvar/6295759 to your computer and use it in GitHub Desktop.
Save cjcolvar/6295759 to your computer and use it in GitHub Desktop.
it "should be able to change group name when authenticated and authorized" do
login_as('policy_editor')
new_group_name = Faker::Lorem.word
post 'update', group_name: new_group_name, new_user: "", id: group.name
new_group = Admin::Group.find(new_group_name)
new_group.should_not be_nil
p group.inspect
p new_group.inspect
new_group.users.should == group.users
flash[:notice].should_not be_nil
response.should redirect_to(edit_admin_group_path(new_group))
end
[cjcolvar@localhost avalon]$ rspec spec/controllers/groups_controller_spec.rb
......"#<Admin::Group:0x000000090d0f30 @saved=true, @users=[\"demarco@ko.org\"], @new_record=true, @changed_attributes={\"name\"=>nil, \"users\"=>[]}, @previous_name=nil, @name=\"quae\", @validation_context=nil, @errors=#<ActiveModel::Errors:0x000000091598f8 @base=#<Admin::Group:0x000000090d0f30 ...>, @messages={}>>"
"#<Admin::Group:0x0000000a4d34b0 @saved=true, @users=[], @new_record=false, @changed_attributes={\"name\"=>nil}, @previous_name=nil, @name=\"eaque\">"
F......
Failures:
1) Admin::GroupsController Modifying a group: editing a group should be able to change group name when authenticated and authorized
Failure/Error: new_group.users.should == group.users
expected: ["demarco@ko.org"]
got: [] (using ==)
# ./spec/controllers/groups_controller_spec.rb:107:in `block (4 levels) in <top (required)>'
Finished in 30.73 seconds
13 examples, 1 failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment