it {should_not be_valid} and @user.should_not be valid

I'm learning rails and rspec, and don't undestand the difference between these two codes:

in my spec/models/user_spec.rb I have:

describe User do$
  before { @user = "Example User", email: "") }
  subject {@user}

Now I check name format:

describe "when name has wrong format" do
  it "should not be valid" do    
    names = %w[%marcin ??? 123 ___123 ___] 
    names.each do |invalid_name| = invalid_name      
      it{should_not be_valid}        

it's not working but when I use @user.should_not be_valid instead of it{should_not be_valid} it works ok, I don't undestand why as I have subject {@user} so I thought it {should means the same as @user.should


describe User do
  subject do name, email: "")

  describe "#name" do  
    context "Just Numbers" do
      let(:name) { "123" }
      it { should_not be_valid }

Need Your Help

How do I dynamically set a static “#define” variable in a header (.h) file?

objective-c ios4 sharekit

I am using an open source component in my iOS project (sharekit), and they defined static variables in the header file. For example, in SHKConfig.h they define the App Name as:

LoginButton facebook android settext ();

android facebook button user-interface facebook-login

I have a problem while I try to set my text into com.facebook.widget.LoginButton

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.