<commit_before>require 'spec_helper'

describe 'member' do

  context 'valid member' do
    before(:each) do
      @member = FactoryGirl.build(:member)
    end

    it 'should save a basic member' do
      @member.save.should be_true
    end

    it 'should be fetchable from the database' do
      @member.save
      @member2 = Member.find(@member.id)
      @member2.should be_an_instance_of Member
      @member2.login_name.should match(/member\d+/)
      @member2.encrypted_password.should_not be_nil
    end

    it 'should have a friendly slug' do
      @member.save
      @member.slug.should match(/member\d+/)
    end

    it 'should have a default garden' do
      @member.save
      @member.gardens.count.should == 1
    end

    it 'should have a accounts entry' do
      @member.save
      @member.account.should be_an_instance_of Account
    end

    it "should have a free account by default" do
      @member.save
      @member.account.account_type.name.should eq "Free"
      @member.is_paid?.should be_false
    end

    it "doesn't show email by default" do
      @member.save
      @member.show_email.should be_false
    end

    it 'should stringify as the login_name' do
      @member.save
      @member.to_s.should match(/member\d+/)
      "#{@member}".should match(/member\d+/)
    end

    it 'should be able to fetch posts' do
      @post = FactoryGirl.create(:post, :author => @member)
      @member.posts.should eq [@post]<commit_msg>Updated tests to test for the default account type.<commit_after>require 'spec_helper'

describe 'member' do

  context 'valid member' do
    before(:each) do
      @member = FactoryGirl.build(:member)
    end

    it 'should save a basic member' do
      @member.save.should be_true
    end

    it 'should be fetchable from the database' do
      @member.save
      @member2 = Member.find(@member.id)
      @member2.should be_an_instance_of Member
      @member2.login_name.should match(/member\d+/)
      @member2.encrypted_password.should_not be_nil
    end

    it 'should have a friendly slug' do
      @member.save
      @member.slug.should match(/member\d+/)
    end

    it 'should have a default garden' do
      @member.save
      @member.gardens.count.should == 1
    end

    it 'should have a accounts entry' do
      @member.save
      @member.account.should be_an_instance_of Account
    end

    it "should have a default-type account by default" do
      @member.save
      @member.account.account_type.name.should eq Growstuff::Application.config.default_account_type
 
      @member.is_paid?.should be_false
    end

    it "doesn't show email by default" do
      @member.save
      @member.show_email.should be_false
    end

    it 'should stringify as the login_name' do
      @member.save
      @member.to_s.should match(/member\d+/)
      "#{@member}".should match(/member\d+/)
    end

    it 'should be able to fetch posts' do
      @post = FactoryGirl.create(:post, :author => @member)
      @member.posts.should eq [@post]
{'fraction_non_alphanumeric': 0.09827357237715803, 'fraction_numerical': 0.0033200531208499337, 'mean_word_length': 2.582639714625446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6509275', 'n_tokens_mistral': 962, 'n_tokens_neox': 924, 'n_words': 271}