Trouble on evaluating other model data


I am using Ruby on Rails 3.0.9 and RSpec 2. In my spec file I have code like the following:

describe User do let(:authorizations) { Authorization.all.map(&:name) } it "should have a 'registered' value" do authorizations.should include("registered") end end

When I run the above test I get:

User should have a 'registered' value Failure/Error: authorizations.should include("registered") expected [] to include "registered" Diff: @@ -1,2 +1,2 @@ -registered +[]

<strong>Is it possible to solve the above error\problem? If so, how can I do?</strong>


The above tells me that you have you all empty tables in your test database. You should either consider <a href="http://ryandaigle.com/articles/2009/5/13/what-s-new-in-edge-rails-database-seeding" rel="nofollow">seeding</a> your dev/test databases. (in case your consider Authorization to be a look up kind of entity)


using something a <a href="http://rpheath.com/posts/411-how-to-use-factory-girl-with-rspec" rel="nofollow">factory girl</a> to create some test data for yourself in the before block of your spec.


  • Traversing directories and reading from files in ruby on rails
  • Rails 3 Notices don't work when using Redirect_To
  • SignalR dependency injection via Spring.Net
  • Phalcon\\Mvc\\Model::validation() and non-model validators
  • How do I configure Maven Cargo to use an embedded Tomcat server?
  • Uber API - requests endpoint cannot read read json
  • ConnectivityManager.CONNECTIVITY_ACTION deprecated
  • Is there a way to do normal logging with EureakLog?
  • Time complexity of a program which involves multiple variables
  • Admob requires api-13 or later can I not deploy on old API-8 phones?
  • Test if a set exists before trying to drop it
  • Spark fat jar to run multiple versions on YARN
  • Asynchronous UI Testing in Xcode With Swift
  • Scrapy recursive link crawler
  • Spring Data JPA custom method causing PropertyReferenceException
  • NetLogo BehaviorSpace - Measure runs using reporters
  • How to recover from a Spring Social ExpiredAuthorizationException
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • script to move all files from one location to another location
  • Perl system calls when running as another user using sudo
  • JSON with duplicate key names losing information when parsed
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Jquery - Jquery Wysiwyg return html as a string
  • Rearranging Cells in UITableView Bug & Saving Changes
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • Circular dependency while pushing http interceptor
  • Linker errors when using intrinsic function via function pointer
  • Revoking OAuth Access Token Results in 404 Not Found
  • Buffer size for converting unsigned long to string
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • File not found error Google Drive API
  • How to get Windows thread pool to call class member function?
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Running Map reduces the dimensions of the matrices
  • Android Heatmap on canvas or ImageView